diff options
| author | Ronan Charles-Lorel <ronan.charleslorel@gmail.com> | 2023-01-31 15:20:57 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-01-31 15:20:57 +0100 |
| commit | a2ac791bb779297bedb608825602912228d415c1 (patch) | |
| tree | 0045a4de6ee8306fd114f896adcc8bc14433af24 /Emby.Server.Implementations/IO/ManagedFileSystem.cs | |
| parent | 992b460912f3100f126bc4db0fe042fd4aefee7c (diff) | |
Add a way to add more invalid characters when sanitizing a filename
Diffstat (limited to 'Emby.Server.Implementations/IO/ManagedFileSystem.cs')
| -rw-r--r-- | Emby.Server.Implementations/IO/ManagedFileSystem.cs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Emby.Server.Implementations/IO/ManagedFileSystem.cs b/Emby.Server.Implementations/IO/ManagedFileSystem.cs index 55f384ae8..9b8831a1f 100644 --- a/Emby.Server.Implementations/IO/ManagedFileSystem.cs +++ b/Emby.Server.Implementations/IO/ManagedFileSystem.cs @@ -294,7 +294,9 @@ namespace Emby.Server.Implementations.IO /// <exception cref="ArgumentNullException">The filename is null.</exception> public string GetValidFilename(string filename) { - var invalid = Path.GetInvalidFileNameChars(); + //necessary because (as per the doc) GetInvalidFileNameChars is not exhaustive and may not return all invalid chars, which creates issues + char[] genericInvalidChars = {':'}; + var invalid = Path.GetInvalidFileNameChars().Concat(genericInvalidChars).ToArray(); var first = filename.IndexOfAny(invalid); if (first == -1) { |
