Skip to content

Commit

Permalink
enforce sanitization of filename (fixes #19)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gargaj committed Mar 25, 2024
1 parent 7d24cdf commit cbbef1f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Source/Dialogs/DownloadDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using System.Windows.Forms;
using Conduit.Sites;
using Conduit.Unpackers;
using System.Security.Cryptography;

namespace Conduit
{
Expand Down Expand Up @@ -116,6 +117,8 @@ private async Task<string> DownloadFile(string url, string targetPath)
MessageBox.Show($"Unable to deduce filename from {finalURL}; will rename it to {filename} and see where it goes...", "Conduit error: Download dodgy", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}

filename = string.Join("_", filename.Split(Path.GetInvalidFileNameChars(), StringSplitOptions.RemoveEmptyEntries));

localFileName = Path.Combine(targetPath, filename);

var stream = response.GetResponseStream();
Expand Down

0 comments on commit cbbef1f

Please sign in to comment.