Fixed: Regression with importing nested obfuscated directories.

Closes #2640
This commit is contained in:
Taloth Saldono 2018-07-04 21:52:26 +02:00
parent 48126f55ed
commit e9b11e55e9
4 changed files with 29 additions and 0 deletions

View File

@ -29,6 +29,13 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Specifications
}; };
} }
[Test]
public void should_return_true_if_no_fileinfo_available()
{
_localEpisode.FileEpisodeInfo = null;
Subject.IsSatisfiedBy(_localEpisode, null).Accepted.Should().BeTrue();
}
[Test] [Test]
public void should_return_false_when_file_contains_the_full_season() public void should_return_false_when_file_contains_the_full_season()
{ {

View File

@ -50,6 +50,15 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Specifications
Subject.IsSatisfiedBy(_localEpisode, null).Accepted.Should().BeTrue(); Subject.IsSatisfiedBy(_localEpisode, null).Accepted.Should().BeTrue();
} }
[Test]
public void should_be_accepted_if_file_name_is_not_parseable()
{
_localEpisode.Path = @"C:\Test\Unsorted\Series.Title.S01E01\AFDAFD.mkv".AsOsAgnostic();
_localEpisode.FileEpisodeInfo = null;
Subject.IsSatisfiedBy(_localEpisode, null).Accepted.Should().BeTrue();
}
[Test] [Test]
public void should_should_be_accepted_for_full_season() public void should_should_be_accepted_for_full_season()
{ {

View File

@ -16,6 +16,11 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Specifications
public Decision IsSatisfiedBy(LocalEpisode localEpisode, DownloadClientItem downloadClientItem) public Decision IsSatisfiedBy(LocalEpisode localEpisode, DownloadClientItem downloadClientItem)
{ {
if (localEpisode.FileEpisodeInfo == null)
{
return Decision.Accept();
}
if (localEpisode.FileEpisodeInfo.FullSeason) if (localEpisode.FileEpisodeInfo.FullSeason)
{ {
_logger.Debug("Single episode file detected as containing all episodes in the season"); _logger.Debug("Single episode file detected as containing all episodes in the season");

View File

@ -34,11 +34,19 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Specifications
if (folderInfo == null) if (folderInfo == null)
{ {
_logger.Debug("No folder ParsedEpisodeInfo, skipping check");
return Decision.Accept();
}
if (fileInfo == null)
{
_logger.Debug("No file ParsedEpisodeInfo, skipping check");
return Decision.Accept(); return Decision.Accept();
} }
if (!folderInfo.EpisodeNumbers.Any()) if (!folderInfo.EpisodeNumbers.Any())
{ {
_logger.Debug("No episode numbers in folder ParsedEpisodeInfo, skipping check");
return Decision.Accept(); return Decision.Accept();
} }