1
0
mirror of https://github.com/Radarr/Radarr.git synced 2026-03-05 13:21:25 -05:00

Fixed: Health warning for downloading inside root folders

(cherry picked from commit 1e9fd02e9d2bf57247adcac5728e2a0d2b084b86)
This commit is contained in:
Bogdan
2025-01-31 17:04:55 +02:00
parent c7aa1bae5e
commit 8853dced9f
2 changed files with 16 additions and 3 deletions

View File

@@ -76,6 +76,19 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
Subject.Check().ShouldBeWarning(wikiFragment: "downloads-in-root-folder");
}
[Test]
public void should_return_warning_if_downloading_inside_root_folder()
{
var rootFolderPath = "c:\\Test".AsOsAgnostic();
var downloadRootPath = "c:\\Test\\Downloads".AsOsAgnostic();
GivenRootFolder(rootFolderPath);
_clientStatus.OutputRootFolders = new List<OsPath> { new (downloadRootPath) };
Subject.Check().ShouldBeWarning();
}
[Test]
public void should_return_ok_if_not_downloading_to_root_folder()
{
@@ -87,7 +100,7 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
}
[Test]
[TestCaseSource("DownloadClientExceptions")]
[TestCaseSource(nameof(DownloadClientExceptions))]
public void should_return_ok_if_client_throws_downloadclientexception(Exception ex)
{
_downloadClient.Setup(s => s.GetStatus())

View File

@@ -48,7 +48,7 @@ namespace NzbDrone.Core.HealthCheck.Checks
try
{
var status = client.GetStatus();
var folders = status.OutputRootFolders.Where(folder => rootFolders.Any(r => r.Path.PathEquals(folder.FullPath)));
var folders = rootFolders.Where(r => status.OutputRootFolders.Any(folder => r.Path.PathEquals(folder.FullPath) || r.Path.IsParentPath(folder.FullPath)));
foreach (var folder in folders)
{
@@ -57,7 +57,7 @@ namespace NzbDrone.Core.HealthCheck.Checks
_localizationService.GetLocalizedString("DownloadClientRootFolderHealthCheckMessage", new Dictionary<string, object>
{
{ "downloadClientName", client.Definition.Name },
{ "rootFolderPath", folder.FullPath }
{ "rootFolderPath", folder.Path }
}),
"#downloads-in-root-folder");
}