Merge pull request #7521 from 1337joe/image-mime-fallback
Add fallback for image downloads with bad reported MediaType
(cherry picked from commit bf1ccf7493
)
Signed-off-by: Joshua Boniface <joshua@boniface.me>
This commit is contained in:
parent
02e06acb71
commit
97bf6c7364
|
@ -30,6 +30,7 @@ using MediaBrowser.Model.Configuration;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
using MediaBrowser.Model.Extensions;
|
using MediaBrowser.Model.Extensions;
|
||||||
using MediaBrowser.Model.IO;
|
using MediaBrowser.Model.IO;
|
||||||
|
using MediaBrowser.Model.Net;
|
||||||
using MediaBrowser.Model.Providers;
|
using MediaBrowser.Model.Providers;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Priority_Queue;
|
using Priority_Queue;
|
||||||
|
@ -188,6 +189,12 @@ namespace MediaBrowser.Providers.Manager
|
||||||
throw new HttpRequestException("Invalid image received.", null, HttpStatusCode.NotFound);
|
throw new HttpRequestException("Invalid image received.", null, HttpStatusCode.NotFound);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// some iptv/epg providers don't correctly report media type, extract from url if no extension found
|
||||||
|
if (string.IsNullOrWhiteSpace(MimeTypes.ToExtension(contentType)))
|
||||||
|
{
|
||||||
|
contentType = MimeTypes.GetMimeType(url);
|
||||||
|
}
|
||||||
|
|
||||||
await using var stream = await response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
|
await using var stream = await response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
|
||||||
await SaveImage(
|
await SaveImage(
|
||||||
item,
|
item,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user