#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:
KZ
2015-09-21 18:48:53 +01:00
parent f45c58b2bd
commit e8bb1680f3
7 changed files with 1170 additions and 1115 deletions

View File

@@ -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;
}