mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-08 02:34:19 -04:00
Extension lookup tv icons
This commit is contained in:
parent
d1d5ea9c80
commit
96cf13060d
@ -200,11 +200,25 @@ 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))
|
||||||
{
|
{
|
||||||
|
// First, check for imagecache special case
|
||||||
if (url.Contains("/imagecache/", StringComparison.OrdinalIgnoreCase))
|
if (url.Contains("/imagecache/", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
contentType = MediaTypeNames.Image.Png;
|
contentType = "image/png";
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
// Deduce content type from file extension
|
||||||
|
var fileExtension = Path.GetExtension(url)?.ToLowerInvariant();
|
||||||
|
contentType = fileExtension switch
|
||||||
|
{
|
||||||
|
".jpg" or ".jpeg" => "image/jpeg",
|
||||||
|
".png" => "image/png",
|
||||||
|
".gif" => "image/gif",
|
||||||
|
".webp" => "image/webp",
|
||||||
|
_ => null
|
||||||
|
};
|
||||||
|
|
||||||
|
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