diff --git a/LANCommander.SDK/Extensions/StringExtensions.cs b/LANCommander.SDK/Extensions/StringExtensions.cs index 9771b96..ceb939c 100644 --- a/LANCommander.SDK/Extensions/StringExtensions.cs +++ b/LANCommander.SDK/Extensions/StringExtensions.cs @@ -7,9 +7,13 @@ namespace LANCommander.SDK.Extensions { public static string SanitizeFilename(this string filename, string replacement = "") { + var colonInTitle = new Regex(@"(\w)(: )(\w)"); var removeInvalidChars = new Regex($"[{Regex.Escape(new string(Path.GetInvalidFileNameChars()))}]", RegexOptions.Singleline | RegexOptions.Compiled | RegexOptions.CultureInvariant); - return removeInvalidChars.Replace(filename, replacement); + filename = colonInTitle.Replace(filename, "$1 - $3"); + filename = removeInvalidChars.Replace(filename, replacement); + + return filename; } } }