Skip to content

Commit

Permalink
Fixed: (Cardigann) Search path redirect
Browse files Browse the repository at this point in the history
Fixes #1102
  • Loading branch information
Qstick committed Sep 27, 2022
1 parent 25217c0 commit 0a111e7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
Expand Up @@ -945,6 +945,11 @@ protected string MatchSelector(HttpResponse response, SelectorField selector, Di

public bool CheckIfLoginIsNeeded(HttpResponse response)
{
if (_definition.Login == null || _definition.Login.Test == null)
{
return false;
}

if (response.HasHttpRedirect)
{
var domainHint = GetRedirectDomainHint(response);
Expand All @@ -958,11 +963,6 @@ public bool CheckIfLoginIsNeeded(HttpResponse response)
return true;
}

if (_definition.Login == null || _definition.Login.Test == null)
{
return false;
}

if (response.HasHttpError)
{
return true;
Expand Down Expand Up @@ -1124,6 +1124,8 @@ private IEnumerable<IndexerRequest> GetRequest(Dictionary<string, object> variab

var request = new CardigannRequest(requestbuilder.SetEncoding(_encoding).Build(), variables, searchPath);

request.HttpRequest.AllowAutoRedirect = searchPath.Followredirect;

yield return request;
}
}
Expand Down
Expand Up @@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using DryIoc;
using NzbDrone.Common.Extensions;
using NzbDrone.Common.Http;
using NzbDrone.Core.IndexerSearch.Definitions;
Expand Down Expand Up @@ -268,7 +269,10 @@ private IEnumerable<IndexerRequest> GetPagedRequests(SearchCriteriaBase searchCr
parameters.Add("offset", searchCriteria.Offset.ToString());
}

yield return new IndexerRequest(string.Format("{0}&{1}", baseUrl, parameters.GetQueryString()), HttpAccept.Rss);
var request = new IndexerRequest(string.Format("{0}&{1}", baseUrl, parameters.GetQueryString()), HttpAccept.Rss);
request.HttpRequest.AllowAutoRedirect = true;

yield return request;
}

private static string NewsnabifyTitle(string title)
Expand Down
2 changes: 0 additions & 2 deletions src/NzbDrone.Core/Indexers/HttpIndexerBase.cs
Expand Up @@ -355,8 +355,6 @@ protected virtual async Task<IndexerResponse> FetchIndexerResponse(IndexerReques
request.HttpRequest.LogResponseContent = true;
}

request.HttpRequest.AllowAutoRedirect = FollowRedirect;

var originalUrl = request.Url;

Cookies = GetCookies();
Expand Down

0 comments on commit 0a111e7

Please sign in to comment.