1
0
Fork 0
mirror of https://github.com/Sonarr/Sonarr synced 2024-12-22 07:43:01 +00:00

Fixed: Replace illegal characters even when renaming is disabled

Closes #7183
This commit is contained in:
Mark McDowall 2024-09-05 20:46:10 -07:00 committed by Mark McDowall
parent 6a332b40ac
commit 4d8a443681
2 changed files with 17 additions and 3 deletions

View file

@ -274,7 +274,7 @@ namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests
{
_namingConfig.RenameEpisodes = false;
_episodeFile.RelativePath = null;
_episodeFile.Path = @"C:\Test\Unsorted\Series - S01E01 - Test";
_episodeFile.Path = @"C:\Test\Unsorted\Series - S01E01 - Test".AsOsAgnostic();
Subject.BuildFileName(new List<Episode> { _episode1 }, _series, _episodeFile)
.Should().Be(Path.GetFileNameWithoutExtension(_episodeFile.Path));
@ -291,6 +291,20 @@ namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests
.Should().Be("30.Rock.S01E01.xvid-LOL");
}
[Test]
public void should_replace_illegal_characters_when_renaming_is_disabled()
{
_namingConfig.RenameEpisodes = false;
_namingConfig.ReplaceIllegalCharacters = true;
_namingConfig.ColonReplacementFormat = ColonReplacementFormat.Smart;
_episodeFile.SceneName = "30.Rock.S01E01.xvid:LOL";
_episodeFile.RelativePath = "30 Rock - S01E01 - Test";
Subject.BuildFileName(new List<Episode> { _episode1 }, _series, _episodeFile)
.Should().Be("30.Rock.S01E01.xvid-LOL");
}
[Test]
public void should_use_airDate_if_series_isDaily_and_not_a_special()
{

View file

@ -1116,10 +1116,10 @@ namespace NzbDrone.Core.Organizer
{
if (episodeFile.SceneName.IsNullOrWhiteSpace())
{
return GetOriginalFileName(episodeFile, useCurrentFilenameAsFallback);
return CleanFileName(GetOriginalFileName(episodeFile, useCurrentFilenameAsFallback));
}
return episodeFile.SceneName;
return CleanFileName(episodeFile.SceneName);
}
private string GetOriginalFileName(EpisodeFile episodeFile, bool useCurrentFilenameAsFallback)