Fixed: TheTVDB metadata images containing html content

This commit is contained in:
Taloth Saldono 2020-06-25 23:40:37 +02:00
parent 25b763a052
commit 87a64cdacb
3 changed files with 13 additions and 0 deletions

View File

@ -249,6 +249,11 @@ namespace NzbDrone.Common.Http
var request = new HttpRequest(url); var request = new HttpRequest(url);
request.ResponseStream = fileStream; request.ResponseStream = fileStream;
var response = Get(request); var response = Get(request);
if (response.Headers.ContentType != null && response.Headers.ContentType.Contains("text/html"))
{
throw new HttpException(request, response, "Site responded with html content.");
}
} }
stopWatch.Stop(); stopWatch.Stop();
if (File.Exists(fileName)) if (File.Exists(fileName))

View File

@ -450,6 +450,10 @@ namespace NzbDrone.Core.Extras.Metadata
} }
_mediaFileAttributeService.SetFilePermissions(fullPath); _mediaFileAttributeService.SetFilePermissions(fullPath);
} }
catch (HttpException ex)
{
_logger.Warn(ex, "Couldn't download image {0} for {1}. {2}", image.Url, series, ex.Message);
}
catch (WebException ex) catch (WebException ex)
{ {
_logger.Warn(ex, "Couldn't download image {0} for {1}. {2}", image.Url, series, ex.Message); _logger.Warn(ex, "Couldn't download image {0} for {1}. {2}", image.Url, series, ex.Message);

View File

@ -122,6 +122,10 @@ namespace NzbDrone.Core.MediaCover
updated = true; updated = true;
} }
} }
catch (HttpException e)
{
_logger.Warn("Couldn't download media cover for {0}. {1}", series, e.Message);
}
catch (WebException e) catch (WebException e)
{ {
_logger.Warn("Couldn't download media cover for {0}. {1}", series, e.Message); _logger.Warn("Couldn't download media cover for {0}. {1}", series, e.Message);