1
0
Fork 0
mirror of https://github.com/Sonarr/Sonarr synced 2025-03-03 18:26:42 +00:00

Fixed: Health warning for downloading inside root folders

This commit is contained in:
Bogdan 2025-01-31 17:04:55 +02:00 committed by Mark McDowall
parent 413d6b996b
commit bb0ad312f1
No known key found for this signature in database
2 changed files with 16 additions and 3 deletions

View file

@ -76,6 +76,19 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
Subject.Check().ShouldBeWarning();
}
[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");
}