From 621bb20756e61372524e9fa4987d2de11ee50032 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Sun, 1 Aug 2021 13:17:03 -0700 Subject: [PATCH] Improve default path for Synology Download Station Fixes: Missing default path for Download Station Fixes: Error when getting destination path for Synology Download Station in health check (cherry picked from commit 4bf3ab1511b4ea25642476bf9df13f91b6f73d76) --- .../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 65a36fc6e..f75a7436d 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 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests 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 ec1cb5f52..a761d5adc 100644 --- a/src/NzbDrone.Core.Test/Download/DownloadClientTests/DownloadStationTests/UsenetDownloadStationFixture.cs +++ b/src/NzbDrone.Core.Test/Download/DownloadClientTests/DownloadStationTests/UsenetDownloadStationFixture.cs @@ -308,7 +308,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests 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 70d8462d3..4a1016d08 100644 --- a/src/NzbDrone.Core/Download/Clients/DownloadStation/TorrentDownloadStation.cs +++ b/src/NzbDrone.Core/Download/Clients/DownloadStation/TorrentDownloadStation.cs @@ -450,14 +450,15 @@ namespace NzbDrone.Core.Download.Clients.DownloadStation { return Settings.TvDirectory.TrimStart('/'); } - else if (Settings.MusicCategory.IsNotNullOrWhiteSpace()) - { - var destDir = GetDefaultDir(); + var destDir = GetDefaultDir(); + + if (Settings.MusicCategory.IsNotNullOrWhiteSpace()) + { return $"{destDir.TrimEnd('/')}/{Settings.MusicCategory}"; } - 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 31789324e..753a845be 100644 --- a/src/NzbDrone.Core/Download/Clients/DownloadStation/UsenetDownloadStation.cs +++ b/src/NzbDrone.Core/Download/Clients/DownloadStation/UsenetDownloadStation.cs @@ -426,14 +426,15 @@ namespace NzbDrone.Core.Download.Clients.DownloadStation { return Settings.TvDirectory.TrimStart('/'); } - else if (Settings.MusicCategory.IsNotNullOrWhiteSpace()) - { - var destDir = GetDefaultDir(); + var destDir = GetDefaultDir(); + + if (Settings.MusicCategory.IsNotNullOrWhiteSpace()) + { return $"{destDir.TrimEnd('/')}/{Settings.MusicCategory}"; } - return null; + return destDir.TrimEnd('/'); } } }