From db7babc6ed748c4e5b4701ca26b23f0f122a0f68 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Sun, 1 Aug 2021 13:17:03 -0700 Subject: [PATCH] Fixes: Missing default path for Download Station Fixes: Error when getting destination path for Synology Download Station in health check (cherrypicked from 4bf3ab1511b4ea25642476bf9df13f91b6f73d76) Closes #6508 --- .../TorrentDownloadStationFixture.cs | 2 +- .../DownloadStationTests/UsenetDownloadStationFixture.cs | 2 +- .../Clients/DownloadStation/TorrentDownloadStation.cs | 9 +++++---- .../Clients/DownloadStation/UsenetDownloadStation.cs | 9 +++++---- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/NzbDrone.Core.Test/Download/DownloadClientTests/DownloadStationTests/TorrentDownloadStationFixture.cs b/src/NzbDrone.Core.Test/Download/DownloadClientTests/DownloadStationTests/TorrentDownloadStationFixture.cs index c3d0c628b2..4f0e7cd66b 100644 --- a/src/NzbDrone.Core.Test/Download/DownloadClientTests/DownloadStationTests/TorrentDownloadStationFixture.cs +++ b/src/NzbDrone.Core.Test/Download/DownloadClientTests/DownloadStationTests/TorrentDownloadStationFixture.cs @@ -431,7 +431,7 @@ public void Download_without_TvDirectory_and_Category_should_use_default() id.Should().NotBeNullOrEmpty(); Mocker.GetMock() - .Verify(v => v.AddTaskFromUrl(It.IsAny(), null, It.IsAny()), Times.Once()); + .Verify(v => v.AddTaskFromUrl(It.IsAny(), _defaultDestination, It.IsAny()), Times.Once()); } [Test] diff --git a/src/NzbDrone.Core.Test/Download/DownloadClientTests/DownloadStationTests/UsenetDownloadStationFixture.cs b/src/NzbDrone.Core.Test/Download/DownloadClientTests/DownloadStationTests/UsenetDownloadStationFixture.cs index 1039ed78af..9abfd1e2d8 100644 --- a/src/NzbDrone.Core.Test/Download/DownloadClientTests/DownloadStationTests/UsenetDownloadStationFixture.cs +++ b/src/NzbDrone.Core.Test/Download/DownloadClientTests/DownloadStationTests/UsenetDownloadStationFixture.cs @@ -313,7 +313,7 @@ public void Download_without_TvDirectory_and_Category_should_use_default() id.Should().NotBeNullOrEmpty(); Mocker.GetMock() - .Verify(v => v.AddTaskFromData(It.IsAny(), It.IsAny(), null, It.IsAny()), Times.Once()); + .Verify(v => v.AddTaskFromData(It.IsAny(), It.IsAny(), _defaultDestination, It.IsAny()), Times.Once()); } [Test] diff --git a/src/NzbDrone.Core/Download/Clients/DownloadStation/TorrentDownloadStation.cs b/src/NzbDrone.Core/Download/Clients/DownloadStation/TorrentDownloadStation.cs index 2c6c12b12f..79af766137 100644 --- a/src/NzbDrone.Core/Download/Clients/DownloadStation/TorrentDownloadStation.cs +++ b/src/NzbDrone.Core/Download/Clients/DownloadStation/TorrentDownloadStation.cs @@ -451,14 +451,15 @@ protected string GetDownloadDirectory() { return Settings.TvDirectory.TrimStart('/'); } - else if (Settings.TvCategory.IsNotNullOrWhiteSpace()) - { - var destDir = GetDefaultDir(); + var destDir = GetDefaultDir(); + + if (Settings.TvCategory.IsNotNullOrWhiteSpace()) + { return $"{destDir.TrimEnd('/')}/{Settings.TvCategory}"; } - return null; + return destDir.TrimEnd('/'); } } } diff --git a/src/NzbDrone.Core/Download/Clients/DownloadStation/UsenetDownloadStation.cs b/src/NzbDrone.Core/Download/Clients/DownloadStation/UsenetDownloadStation.cs index a04069a052..d708281e09 100644 --- a/src/NzbDrone.Core/Download/Clients/DownloadStation/UsenetDownloadStation.cs +++ b/src/NzbDrone.Core/Download/Clients/DownloadStation/UsenetDownloadStation.cs @@ -427,14 +427,15 @@ protected string GetDownloadDirectory() { return Settings.TvDirectory.TrimStart('/'); } - else if (Settings.TvCategory.IsNotNullOrWhiteSpace()) - { - var destDir = GetDefaultDir(); + var destDir = GetDefaultDir(); + + if (Settings.TvCategory.IsNotNullOrWhiteSpace()) + { return $"{destDir.TrimEnd('/')}/{Settings.TvCategory}"; } - return null; + return destDir.TrimEnd('/'); } } }