Check response status code before saving images
This commit is contained in:
parent
800c039612
commit
3ca9b13f99
|
@ -158,6 +158,14 @@ namespace MediaBrowser.Providers.Manager
|
||||||
var httpClient = _httpClientFactory.CreateClient(NamedClient.Default);
|
var httpClient = _httpClientFactory.CreateClient(NamedClient.Default);
|
||||||
using var response = await httpClient.GetAsync(url, cancellationToken).ConfigureAwait(false);
|
using var response = await httpClient.GetAsync(url, cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
|
if (response.StatusCode != HttpStatusCode.OK)
|
||||||
|
{
|
||||||
|
throw new HttpException($"Invalid image received ({response.StatusCode}).")
|
||||||
|
{
|
||||||
|
StatusCode = response.StatusCode
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
var contentType = response.Content.Headers.ContentType.MediaType;
|
var contentType = response.Content.Headers.ContentType.MediaType;
|
||||||
|
|
||||||
// Workaround for tvheadend channel icons
|
// Workaround for tvheadend channel icons
|
||||||
|
|
Loading…
Reference in New Issue
Block a user