core / firebit: fix download referer. resolves #9758 (#9789)

This commit is contained in:
Diego Heras
2020-10-08 22:21:40 +02:00
committed by GitHub
parent 4daed9ea70
commit c991d27b85
2 changed files with 8 additions and 11 deletions

View File

@@ -381,7 +381,7 @@ namespace Jackett.Common.Indexers
return await Download(uncleanLink, RequestType.GET); return await Download(uncleanLink, RequestType.GET);
} }
protected async Task<byte[]> Download(Uri link, RequestType method, string refererlink = null, Dictionary<string, string>headers = null) protected async Task<byte[]> Download(Uri link, RequestType method, string referer = null, Dictionary<string, string>headers = null)
{ {
// return magnet link // return magnet link
if (link.Scheme == "magnet") if (link.Scheme == "magnet")
@@ -392,7 +392,7 @@ namespace Jackett.Common.Indexers
.Replace("(", "%28") .Replace("(", "%28")
.Replace(")", "%29") .Replace(")", "%29")
.Replace("'", "%27"); .Replace("'", "%27");
var response = await RequestWithCookiesAndRetryAsync(requestLink, null, method, refererlink, null, headers); var response = await RequestWithCookiesAndRetryAsync(requestLink, null, method, referer, null, headers);
if (response.IsRedirect) if (response.IsRedirect)
{ {

View File

@@ -1777,14 +1777,11 @@ namespace Jackett.Common.Indexers
var variables = GetBaseTemplateVariables(); var variables = GetBaseTemplateVariables();
AddTemplateVariablesFromUri(variables, link, ".DownloadUri"); AddTemplateVariablesFromUri(variables, link, ".DownloadUri");
if (Download.Before != null) if (Download.Before != null)
{ await handleRequest(Download.Before, variables, link.ToString());
var beforeresult = await handleRequest(Download.Before, variables, link.ToString());
}
if (Download.Method != null)
{
if (Download.Method == "post") if (Download.Method == "post")
method = RequestType.POST; method = RequestType.POST;
}
if (Download.Selector != null) if (Download.Selector != null)
{ {
var selector = applyGoTemplateText(Download.Selector, variables); var selector = applyGoTemplateText(Download.Selector, variables);
@@ -1819,7 +1816,7 @@ namespace Jackett.Common.Indexers
} }
} }
} }
return await base.Download(link, method); return await base.Download(link, method, link.ToString());
} }
} }
} }