Fixed: History retention for Newsbin

This commit is contained in:
Mark McDowall 2024-01-24 16:34:46 -08:00 committed by Mark McDowall
parent 9e3f9f9618
commit 0ea189d03c
2 changed files with 7 additions and 1 deletions

View File

@ -454,6 +454,8 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.SabnzbdTests
[TestCase("0")] [TestCase("0")]
[TestCase("15d")] [TestCase("15d")]
[TestCase("")]
[TestCase(null)]
public void should_set_history_removes_completed_downloads_false(string historyRetention) public void should_set_history_removes_completed_downloads_false(string historyRetention)
{ {
_config.Misc.history_retention = historyRetention; _config.Misc.history_retention = historyRetention;

View File

@ -278,7 +278,11 @@ namespace NzbDrone.Core.Download.Clients.Sabnzbd
status.OutputRootFolders = new List<OsPath> { _remotePathMappingService.RemapRemoteToLocal(Settings.Host, category.FullPath) }; status.OutputRootFolders = new List<OsPath> { _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), int.TryParse(config.Misc.history_retention.AsSpan(0, config.Misc.history_retention.Length - 1),
out var daysRetention); out var daysRetention);