Fixed: Importing completed downloads from NZBGet with post processing script failing

Fixes #2919
This commit is contained in:
Mark McDowall 2019-02-06 19:26:27 -08:00
parent 95cd327022
commit b319cb9525
2 changed files with 18 additions and 1 deletions

View File

@ -421,5 +421,22 @@ namespace NzbDrone.Core.Test.MediaFiles
Mocker.GetMock<IMediaFileService>()
.Verify(v => v.Delete(It.IsAny<EpisodeFile>(), DeleteMediaFileReason.ManualOverride), Times.Once());
}
[Test]
public void should_use_folder_info_release_title_to_find_relative_path_when_download_client_item_has_an_empty_output_path()
{
var name = "Series.Title.S01E01.720p.HDTV.x264-Sonarr";
var outputPath = Path.Combine(@"C:\Test\Unsorted\TV\".AsOsAgnostic(), name);
var localEpisode = _approvedDecisions.First().LocalEpisode;
_downloadClientItem.OutputPath = new OsPath();
localEpisode.FolderEpisodeInfo = new ParsedEpisodeInfo { ReleaseTitle = name };
localEpisode.Path = Path.Combine(outputPath, "subfolder", name + ".mkv");
Subject.Import(new List<ImportDecision> { _approvedDecisions.First() }, true, _downloadClientItem);
Mocker.GetMock<IMediaFileService>().Verify(v => v.Add(It.Is<EpisodeFile>(c => c.OriginalFilePath == $"{name}\\subfolder\\{name}.mkv".AsOsAgnostic())));
}
}
}

View File

@ -164,7 +164,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport
{
var path = localEpisode.Path;
if (downloadClientItem != null)
if (downloadClientItem != null && !downloadClientItem.OutputPath.IsEmpty)
{
var outputDirectory = downloadClientItem.OutputPath.Directory.ToString();