From 5b7c0a94fb84272a9494b76ddee3c3a00b1042ed Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Wed, 24 Jan 2024 16:34:46 -0800 Subject: [PATCH] Fixed: History retention for Newsbin (cherry picked from commit 0ea189d03c8c5e02c00b96a4281dd9e668d6a9ae) --- .../DownloadClientTests/SabnzbdTests/SabnzbdFixture.cs | 2 ++ src/NzbDrone.Core/Download/Clients/Sabnzbd/Sabnzbd.cs | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/NzbDrone.Core.Test/Download/DownloadClientTests/SabnzbdTests/SabnzbdFixture.cs b/src/NzbDrone.Core.Test/Download/DownloadClientTests/SabnzbdTests/SabnzbdFixture.cs index eb01381884..f6a540acac 100644 --- a/src/NzbDrone.Core.Test/Download/DownloadClientTests/SabnzbdTests/SabnzbdFixture.cs +++ b/src/NzbDrone.Core.Test/Download/DownloadClientTests/SabnzbdTests/SabnzbdFixture.cs @@ -454,6 +454,8 @@ public void should_return_status_with_outputdir_for_version_lt_2(string rootFold [TestCase("0")] [TestCase("15d")] + [TestCase("")] + [TestCase(null)] public void should_set_history_removes_completed_downloads_false(string historyRetention) { _config.Misc.history_retention = historyRetention; diff --git a/src/NzbDrone.Core/Download/Clients/Sabnzbd/Sabnzbd.cs b/src/NzbDrone.Core/Download/Clients/Sabnzbd/Sabnzbd.cs index 47d1d41257..f416077ac4 100644 --- a/src/NzbDrone.Core/Download/Clients/Sabnzbd/Sabnzbd.cs +++ b/src/NzbDrone.Core/Download/Clients/Sabnzbd/Sabnzbd.cs @@ -276,7 +276,11 @@ public override DownloadClientInfo GetStatus() status.OutputRootFolders = new List { _remotePathMappingService.RemapRemoteToLocal(Settings.Host, category.FullPath) }; } - if (config.Misc.history_retention.IsNotNullOrWhiteSpace() && config.Misc.history_retention.EndsWith("d")) + if (config.Misc.history_retention.IsNullOrWhiteSpace()) + { + status.RemovesCompletedDownloads = false; + } + else if (config.Misc.history_retention.EndsWith("d")) { int.TryParse(config.Misc.history_retention.AsSpan(0, config.Misc.history_retention.Length - 1), out var daysRetention);