Merge pull request #4225 from Spacetech/save_image_check

Check response status code before saving images
This commit is contained in:
Bond-009 2020-10-05 10:40:37 +02:00 committed by GitHub
commit f1bf21cffd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -158,6 +158,14 @@ namespace MediaBrowser.Providers.Manager
var httpClient = _httpClientFactory.CreateClient(NamedClient.Default);
using var response = await httpClient.GetAsync(url, cancellationToken).ConfigureAwait(false);
if (response.StatusCode != HttpStatusCode.OK)
{
throw new HttpException("Invalid image received.")
{
StatusCode = response.StatusCode
};
}
var contentType = response.Content.Headers.ContentType.MediaType;
// Workaround for tvheadend channel icons