You've already forked Sonarr
mirror of
https://github.com/Sonarr/Sonarr.git
synced 2025-11-06 09:19:38 +02:00
CleanFileName when getting new filename from MediaFileProvider.
This commit is contained in:
@@ -129,6 +129,18 @@ namespace NzbDrone.Core.Providers
|
||||
result = result.Replace(' ', '.');
|
||||
|
||||
Logger.Debug("New File Name is: {0}", result.Trim());
|
||||
return CleanFilename(result.Trim());
|
||||
}
|
||||
|
||||
public static string CleanFilename(string name)
|
||||
{
|
||||
string result = name;
|
||||
string[] badCharacters = { "\\", "/", "<", ">", "?", "*", ":", "|", "\"" };
|
||||
string[] goodCharacters = { "+", "+", "{", "}", "!", "@", "-", "#", "`" };
|
||||
|
||||
for (int i = 0; i < badCharacters.Length; i++)
|
||||
result = result.Replace(badCharacters[i], goodCharacters[i]);
|
||||
|
||||
return result.Trim();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user