diff --git a/src/NzbDrone.Core.Test/Download/DownloadClientTests/VuzeTests/VuzeFixture.cs b/src/NzbDrone.Core.Test/Download/DownloadClientTests/VuzeTests/VuzeFixture.cs index 9f22764c5..ab10beea8 100644 --- a/src/NzbDrone.Core.Test/Download/DownloadClientTests/VuzeTests/VuzeFixture.cs +++ b/src/NzbDrone.Core.Test/Download/DownloadClientTests/VuzeTests/VuzeFixture.cs @@ -298,7 +298,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.VuzeTests } [Test] - public void should_have_correct_output_directory() + public void should_have_correct_output_directory_for_multifile_torrents() { WindowsOnly(); @@ -315,5 +315,25 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.VuzeTests items.First().OutputPath.Should().Be(@"C:\Downloads\" + _title); } + [Test] + public void should_have_correct_output_directory_for_singlefile_torrents() + { + WindowsOnly(); + + var fileName = _title + ".mkv"; + _downloading.Name = fileName; + _downloading.DownloadDir = @"C:/Downloads"; + + GivenTorrents(new List + { + _downloading + }); + + var items = Subject.GetItems().ToList(); + + items.Should().HaveCount(1); + items.First().OutputPath.Should().Be(@"C:\Downloads\" + fileName); + } + } } diff --git a/src/NzbDrone.Core/Download/Clients/Vuze/Vuze.cs b/src/NzbDrone.Core/Download/Clients/Vuze/Vuze.cs index 1da02e835..dc3bb712e 100644 --- a/src/NzbDrone.Core/Download/Clients/Vuze/Vuze.cs +++ b/src/NzbDrone.Core/Download/Clients/Vuze/Vuze.cs @@ -26,7 +26,19 @@ namespace NzbDrone.Core.Download.Clients.Vuze protected override OsPath GetOutputPath(OsPath outputPath, TransmissionTorrent torrent) { - _logger.Debug("Vuze output directory: {0}", outputPath); + // Vuze has similar behavior as uTorrent: + // - A multi-file torrent is downloaded in a job folder and 'outputPath' points to that directory directly. + // - A single-file torrent is downloaded in the root folder and 'outputPath' poinst to that root folder. + // We have to make sure the return value points to the job folder OR file. + if (outputPath == null || outputPath.FileName == torrent.Name) + { + _logger.Trace("Vuze output directory: {0}", outputPath); + } + else + { + outputPath = outputPath + torrent.Name; + _logger.Trace("Vuze output file: {0}", outputPath); + } return outputPath; } @@ -50,4 +62,4 @@ namespace NzbDrone.Core.Download.Clients.Vuze public override string Name => "Vuze"; } -} \ No newline at end of file +}