mirror of
https://github.com/Jackett/Jackett.git
synced 2025-09-17 17:34:09 +02:00
#181 Fix links are not cleaned before being sent to the webui. Fix failed requests not being forwarded to the caller. Add size display to web ui.
This commit is contained in:
@@ -83,6 +83,11 @@ namespace Jackett.Indexers
|
||||
|
||||
public Uri UncleanLink(Uri link)
|
||||
{
|
||||
if (link.ToString().StartsWith(downloadUrlBase))
|
||||
{
|
||||
return link;
|
||||
}
|
||||
|
||||
return new Uri(downloadUrlBase + link.ToString(), UriKind.RelativeOrAbsolute);
|
||||
}
|
||||
|
||||
@@ -223,6 +228,11 @@ namespace Jackett.Indexers
|
||||
public async virtual Task<byte[]> Download(Uri link)
|
||||
{
|
||||
var response = await RequestBytesWithCookiesAndRetry(link.ToString());
|
||||
if(response.Status != System.Net.HttpStatusCode.OK && response.Status != System.Net.HttpStatusCode.Continue && response.Status != System.Net.HttpStatusCode.PartialContent)
|
||||
{
|
||||
throw new Exception($"Remote server returned {response.Status.ToString()}");
|
||||
}
|
||||
|
||||
return response.Content;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user