1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-09-17 15:02:34 +02:00

Fixed: Follow 301 redirects when fetching torrents (#1653)

Closes #1564
This commit is contained in:
Mitchell Cash 2017-06-11 17:30:51 +10:00 committed by Leonardo Galli
parent 7af88037bb
commit 28b523b504

View File

@ -33,7 +33,7 @@ protected TorrentClientBase(ITorrentFileInfoReader torrentFileInfoReader,
_httpClient = httpClient;
_torrentFileInfoReader = torrentFileInfoReader;
}
public override DownloadProtocol Protocol => DownloadProtocol.Torrent;
public virtual bool PreferTorrentFile => false;
@ -149,7 +149,7 @@ public override string Download(RemoteEpisode remoteMovie)
{
magnetUrl = torrentInfo.MagnetUrl;
}
if (PreferTorrentFile)
{
if (torrentUrl.IsNotNullOrWhiteSpace())
@ -221,7 +221,9 @@ private string DownloadFromWebUrl(RemoteMovie remoteEpisode, string torrentUrl)
var response = _httpClient.Get(request);
if (response.StatusCode == HttpStatusCode.SeeOther || response.StatusCode == HttpStatusCode.Found)
if (response.StatusCode == HttpStatusCode.MovedPermanently ||
response.StatusCode == HttpStatusCode.Found ||
response.StatusCode == HttpStatusCode.SeeOther)
{
var locationHeader = response.Headers.GetSingleValue("Location");
@ -321,7 +323,9 @@ private string DownloadFromWebUrl(RemoteEpisode remoteEpisode, string torrentUrl
var response = _httpClient.Get(request);
if (response.StatusCode == HttpStatusCode.SeeOther || response.StatusCode == HttpStatusCode.Found)
if (response.StatusCode == HttpStatusCode.MovedPermanently ||
response.StatusCode == HttpStatusCode.Found ||
response.StatusCode == HttpStatusCode.SeeOther)
{
var locationHeader = response.Headers.GetSingleValue("Location");