1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-10-03 22:57:18 +02:00

Fixed: Avoid download path check false positives for flood

This commit is contained in:
Qstick 2021-12-29 17:20:20 -06:00
parent 13e44ce19a
commit 7a859f340b
3 changed files with 26 additions and 1 deletions

View File

@ -4,6 +4,7 @@
using FluentValidation.Results;
using NLog;
using NzbDrone.Common.Disk;
using NzbDrone.Common.Extensions;
using NzbDrone.Common.Http;
using NzbDrone.Core.Configuration;
using NzbDrone.Core.Download.Clients.Flood.Models;
@ -233,10 +234,17 @@ public override void RemoveItem(DownloadClientItem item, bool deleteData)
public override DownloadClientInfo GetStatus()
{
var destDir = _proxy.GetClientSettings(Settings).DirectoryDefault;
if (Settings.Destination.IsNotNullOrWhiteSpace())
{
destDir = Settings.Destination;
}
return new DownloadClientInfo
{
IsLocalhost = Settings.Host == "127.0.0.1" || Settings.Host == "::1" || Settings.Host == "localhost",
OutputRootFolders = new List<OsPath> { _remotePathMappingService.RemapRemoteToLocal(Settings.Host, new OsPath(Settings.Destination)) }
OutputRootFolders = new List<OsPath> { _remotePathMappingService.RemapRemoteToLocal(Settings.Host, new OsPath(destDir)) }
};
}

View File

@ -19,6 +19,7 @@ public interface IFloodProxy
Dictionary<string, Torrent> GetTorrents(FloodSettings settings);
List<string> GetTorrentContentPaths(string hash, FloodSettings settings);
void SetTorrentsTags(string hash, IEnumerable<string> tags, FloodSettings settings);
FloodClientSettings GetClientSettings(FloodSettings settings);
}
public class FloodProxy : IFloodProxy
@ -210,5 +211,14 @@ public void SetTorrentsTags(string hash, IEnumerable<string> tags, FloodSettings
HandleRequest(tagsRequest, settings);
}
public FloodClientSettings GetClientSettings(FloodSettings settings)
{
var contentsRequest = BuildRequest(settings).Resource($"/client/settings").Build();
contentsRequest.Method = HttpMethod.Get;
return Json.Deserialize<FloodClientSettings>(HandleRequest(contentsRequest, settings).Content);
}
}
}

View File

@ -0,0 +1,7 @@
namespace NzbDrone.Core.Download.Clients.Flood.Types
{
public class FloodClientSettings
{
public string DirectoryDefault { get; set; }
}
}