Skip to content

Commit

Permalink
fix: trim trailing periods from file names
Browse files Browse the repository at this point in the history
  • Loading branch information
anna-is-cute committed Aug 25, 2024
1 parent e645703 commit 3577f6f
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions DownloadTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -719,14 +719,15 @@ private static string MakeFileNameSafe(string input) {

var sb = new StringBuilder(input.Length);
foreach (var ch in input) {
if (Array.IndexOf(invalid, ch) == -1) {
sb.Append(ch);
} else {
sb.Append('-');
}
sb.Append(
Array.IndexOf(invalid, ch) == -1
? ch
: '-'
);
}

return sb.ToString();
var path = sb.ToString();
return path.TrimEnd('.');
}

private static string[] GetOutputPaths(IReadOnlyCollection<List<string?>> files) {
Expand Down

0 comments on commit 3577f6f

Please sign in to comment.