aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Api/Controllers
diff options
context:
space:
mode:
authorCody Robibero <cody@robibe.ro>2022-01-08 04:45:58 -0700
committerGitHub <noreply@github.com>2022-01-08 04:45:58 -0700
commit9b1965b48ace52d325aeedf31932a860ffadea3f (patch)
tree846e5d2ca77b7a8a764e9afaa5be610885126cc2 /Jellyfin.Api/Controllers
parentce61dff4aae0875cfc359c9d8dc1a8a15f9409cd (diff)
parentdc222b75c55645fce521c572acebb16b278169a5 (diff)
Merge pull request #7101 from Bond-009/imagejpg
Remove incorrect mime type image/jpg
Diffstat (limited to 'Jellyfin.Api/Controllers')
-rw-r--r--Jellyfin.Api/Controllers/DlnaServerController.cs7
-rw-r--r--Jellyfin.Api/Controllers/ImageController.cs11
2 files changed, 7 insertions, 11 deletions
diff --git a/Jellyfin.Api/Controllers/DlnaServerController.cs b/Jellyfin.Api/Controllers/DlnaServerController.cs
index 4e8c01577e..b1c576c330 100644
--- a/Jellyfin.Api/Controllers/DlnaServerController.cs
+++ b/Jellyfin.Api/Controllers/DlnaServerController.cs
@@ -9,6 +9,7 @@ using Emby.Dlna.Main;
using Jellyfin.Api.Attributes;
using Jellyfin.Api.Constants;
using MediaBrowser.Controller.Dlna;
+using MediaBrowser.Model.Net;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
@@ -337,11 +338,7 @@ namespace Jellyfin.Api.Controllers
return NotFound();
}
- var contentType = "image/" + Path.GetExtension(fileName)
- .TrimStart('.')
- .ToLowerInvariant();
-
- return File(icon.Stream, contentType);
+ return File(icon.Stream, MimeTypes.GetMimeType(fileName));
}
private string GetAbsoluteUri()
diff --git a/Jellyfin.Api/Controllers/ImageController.cs b/Jellyfin.Api/Controllers/ImageController.cs
index 86933074d0..e72589cfae 100644
--- a/Jellyfin.Api/Controllers/ImageController.cs
+++ b/Jellyfin.Api/Controllers/ImageController.cs
@@ -1878,8 +1878,8 @@ namespace Jellyfin.Api.Controllers
if (!supportsWebP)
{
var userAgent = Request.Headers[HeaderNames.UserAgent].ToString();
- if (userAgent.IndexOf("crosswalk", StringComparison.OrdinalIgnoreCase) != -1 &&
- userAgent.IndexOf("android", StringComparison.OrdinalIgnoreCase) != -1)
+ if (userAgent.Contains("crosswalk", StringComparison.OrdinalIgnoreCase)
+ && userAgent.Contains("android", StringComparison.OrdinalIgnoreCase))
{
supportsWebP = true;
}
@@ -1905,10 +1905,7 @@ namespace Jellyfin.Api.Controllers
private bool SupportsFormat(IReadOnlyCollection<string> requestAcceptTypes, string acceptParam, ImageFormat format, bool acceptAll)
{
- var normalized = format.ToString().ToLowerInvariant();
- var mimeType = "image/" + normalized;
-
- if (requestAcceptTypes.Contains(mimeType))
+ if (requestAcceptTypes.Contains(format.GetMimeType()))
{
return true;
}
@@ -1918,6 +1915,8 @@ namespace Jellyfin.Api.Controllers
return true;
}
+ // Review if this should be jpeg, jpg or both for ImageFormat.Jpg
+ var normalized = format.ToString().ToLowerInvariant();
return string.Equals(acceptParam, normalized, StringComparison.OrdinalIgnoreCase);
}