mirror of https://github.com/Sonarr/Sonarr
Fixed: Avoid download path check false positives for Flood
Closes #4825
This commit is contained in:
parent
6106362f6c
commit
d4d4bf8784
|
@ -5,6 +5,7 @@ using System.Linq;
|
||||||
using FluentValidation.Results;
|
using FluentValidation.Results;
|
||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Common.Disk;
|
using NzbDrone.Common.Disk;
|
||||||
|
using NzbDrone.Common.Extensions;
|
||||||
using NzbDrone.Common.Http;
|
using NzbDrone.Common.Http;
|
||||||
using NzbDrone.Core.Configuration;
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Download.Clients.Flood.Models;
|
using NzbDrone.Core.Download.Clients.Flood.Models;
|
||||||
|
@ -233,10 +234,17 @@ namespace NzbDrone.Core.Download.Clients.Flood
|
||||||
|
|
||||||
public override DownloadClientInfo GetStatus()
|
public override DownloadClientInfo GetStatus()
|
||||||
{
|
{
|
||||||
|
var destDir = _proxy.GetClientSettings(Settings).DirectoryDefault;
|
||||||
|
|
||||||
|
if (Settings.Destination.IsNotNullOrWhiteSpace())
|
||||||
|
{
|
||||||
|
destDir = Settings.Destination;
|
||||||
|
}
|
||||||
|
|
||||||
return new DownloadClientInfo
|
return new DownloadClientInfo
|
||||||
{
|
{
|
||||||
IsLocalhost = Settings.Host == "127.0.0.1" || Settings.Host == "::1" || Settings.Host == "localhost",
|
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)) }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@ namespace NzbDrone.Core.Download.Clients.Flood
|
||||||
Dictionary<string, Torrent> GetTorrents(FloodSettings settings);
|
Dictionary<string, Torrent> GetTorrents(FloodSettings settings);
|
||||||
List<string> GetTorrentContentPaths(string hash, FloodSettings settings);
|
List<string> GetTorrentContentPaths(string hash, FloodSettings settings);
|
||||||
void SetTorrentsTags(string hash, IEnumerable<string> tags, FloodSettings settings);
|
void SetTorrentsTags(string hash, IEnumerable<string> tags, FloodSettings settings);
|
||||||
|
FloodClientSettings GetClientSettings(FloodSettings settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class FloodProxy : IFloodProxy
|
public class FloodProxy : IFloodProxy
|
||||||
|
@ -209,5 +210,14 @@ namespace NzbDrone.Core.Download.Clients.Flood
|
||||||
|
|
||||||
HandleRequest(tagsRequest, settings);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
namespace NzbDrone.Core.Download.Clients.Flood.Types
|
||||||
|
{
|
||||||
|
public class FloodClientSettings
|
||||||
|
{
|
||||||
|
public string DirectoryDefault { get; set; }
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue