mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-05-24 02:02:29 -04:00
Merge pull request #13076 from theguymadmax/tv-icon-image-fix
Determine tv image type by extension if content-type is unavailable
This commit is contained in:
commit
6691380c04
@ -200,11 +200,19 @@ namespace MediaBrowser.Providers.Manager
|
|||||||
// TODO: Isolate this hack into the tvh plugin
|
// TODO: Isolate this hack into the tvh plugin
|
||||||
if (string.IsNullOrEmpty(contentType))
|
if (string.IsNullOrEmpty(contentType))
|
||||||
{
|
{
|
||||||
|
// Special case for imagecache
|
||||||
if (url.Contains("/imagecache/", StringComparison.OrdinalIgnoreCase))
|
if (url.Contains("/imagecache/", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
contentType = MediaTypeNames.Image.Png;
|
contentType = MediaTypeNames.Image.Png;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
// Deduce content type from file extension
|
||||||
|
contentType = MimeTypes.GetMimeType(new Uri(url).GetLeftPart(UriPartial.Path));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Throw if we still can't determine the content type
|
||||||
|
if (string.IsNullOrEmpty(contentType))
|
||||||
{
|
{
|
||||||
throw new HttpRequestException("Invalid image received: contentType not set.", null, response.StatusCode);
|
throw new HttpRequestException("Invalid image received: contentType not set.", null, response.StatusCode);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user