mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-10-29 23:12:39 +01:00
Fixed: Replace illegal characters even when renaming is disabled
Closes #7183
This commit is contained in:
parent
6a332b40ac
commit
4d8a443681
@ -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()
|
||||
{
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user