1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-20 01:42:35 +01:00

Fixed: Replace illegal characters even when renaming is disabled

(cherry picked from commit 4d8a4436810828494e99f0854cf6de3269668fe4)
This commit is contained in:
Mark McDowall 2024-09-05 20:46:10 -07:00 committed by Bogdan
parent 6686fa0600
commit d2b279a6be
2 changed files with 18 additions and 3 deletions

View File

@ -16,6 +16,7 @@
using NzbDrone.Core.Organizer;
using NzbDrone.Core.Qualities;
using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common;
namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests
{
@ -292,7 +293,7 @@ public void use_path_when_sceneName_and_relative_path_are_null()
{
_namingConfig.RenameMovies = false;
_movieFile.RelativePath = null;
_movieFile.Path = @"C:\Test\Unsorted\Movie - S01E01 - Test";
_movieFile.Path = @"C:\Test\Unsorted\Movie - S01E01 - Test".AsOsAgnostic();
Subject.BuildFileName(_movie, _movieFile)
.Should().Be(Path.GetFileNameWithoutExtension(_movieFile.Path));
@ -309,6 +310,20 @@ public void use_file_name_when_sceneName_is_not_null()
.Should().Be("30.Rock.S01E01.xvid-LOL");
}
[Test]
public void should_replace_illegal_characters_when_renaming_is_disabled()
{
_namingConfig.RenameMovies = false;
_namingConfig.ReplaceIllegalCharacters = true;
_namingConfig.ColonReplacementFormat = ColonReplacementFormat.Smart;
_movieFile.SceneName = "30.Rock.S01E01.xvid:LOL";
_movieFile.RelativePath = "30 Rock - S01E01 - Test";
Subject.BuildFileName(_movie, _movieFile)
.Should().Be("30.Rock.S01E01.xvid-LOL");
}
[Test]
public void should_should_replace_release_group()
{

View File

@ -621,10 +621,10 @@ private string GetOriginalTitle(MovieFile movieFile, bool multipleTokens)
{
if (movieFile.SceneName.IsNullOrWhiteSpace())
{
return GetOriginalFileName(movieFile, multipleTokens);
return CleanFileName(GetOriginalFileName(movieFile, multipleTokens));
}
return movieFile.SceneName;
return CleanFileName(movieFile.SceneName);
}
private string GetOriginalFileName(MovieFile movieFile, bool multipleTokens)