Add a way to add more invalid characters when sanitizing a filename

pull/9219/head
Ronan Charles-Lorel 1 year ago committed by GitHub
parent 992b460912
commit a2ac791bb7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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)
{

Loading…
Cancel
Save