Skip to content

Commit 9cead7a

Browse files
author
Meyn
committed
Fix invalid windows Filenames
1 parent 7c9cabb commit 9cead7a

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

DownloadAssistant/DownloadAssistant.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<PackageProjectUrl></PackageProjectUrl>
1111
<PackageIcon>logo.png</PackageIcon>
1212
<PackageReadmeFile>README.md</PackageReadmeFile>
13-
<Version>1.0.7</Version>
13+
<Version>1.0.8</Version>
1414
<GenerateDocumentationFile>True</GenerateDocumentationFile>
1515
<Description>A free to use library as a download manager.
1616
Includes retry, priority, cancel, etc.. function.
@@ -26,7 +26,7 @@ Features:
2626
<PackageRequireLicenseAcceptance>True</PackageRequireLicenseAcceptance>
2727
<Company>Shard</Company>
2828
<Authors>Meyn</Authors>
29-
<PackageReleaseNotes>Fix path check for UNIX systems in LoadRequest</PackageReleaseNotes>
29+
<PackageReleaseNotes>Fix invalid windows Filenames</PackageReleaseNotes>
3030
<RepositoryUrl>https://github.com/TypNull/DownloadAssistant</RepositoryUrl>
3131
</PropertyGroup>
3232

DownloadAssistant/Utilities/IOManager.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ internal static class IOManager
1414
/// Array of characters that are not allowed in file names.
1515
/// </summary>
1616
public static char[] InvalidFileNameCharsWindows = new char[]
17-
{
17+
{
1818
'\"', '<', '>', '|', '\0',
1919
(char)1, (char)2, (char)3, (char)4, (char)5, (char)6, (char)7, (char)8, (char)9, (char)10,
2020
(char)11, (char)12, (char)13, (char)14, (char)15, (char)16, (char)17, (char)18, (char)19, (char)20,
2121
(char)21, (char)22, (char)23, (char)24, (char)25, (char)26, (char)27, (char)28, (char)29, (char)30,
22-
(char)31, ':', '?', '\\', '/'
23-
};
22+
(char)31, ':', '?', '\\', '/', '*'
23+
};
2424

2525
public static char[] InvalidFileNameCharsUnix = new char[] { '/', '\0' };
2626

@@ -43,10 +43,10 @@ public static string RemoveInvalidFileNameChars(string name)
4343
{
4444
StringBuilder fileBuilder = new(name);
4545
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
46-
foreach (char c in InvalidFileNameCharsWindows)
46+
foreach (char c in InvalidFileNameCharsWindows.Concat(Path.GetInvalidFileNameChars()))
4747
fileBuilder.Replace(c.ToString(), string.Empty);
4848
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux) || RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
49-
foreach (char c in InvalidFileNameCharsUnix)
49+
foreach (char c in InvalidFileNameCharsUnix.Concat(Path.GetInvalidFileNameChars()))
5050
fileBuilder.Replace(c.ToString(), string.Empty);
5151
return fileBuilder.ToString();
5252
}

LICENSE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2024 Shard
3+
Copyright (c) 2025 Shard
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

0 commit comments

Comments
 (0)