diff options
| author | Cody Robibero <cody@robibe.ro> | 2022-01-08 04:45:58 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-01-08 04:45:58 -0700 |
| commit | 9b1965b48ace52d325aeedf31932a860ffadea3f (patch) | |
| tree | 846e5d2ca77b7a8a764e9afaa5be610885126cc2 /Jellyfin.Api/Controllers/ImageController.cs | |
| parent | ce61dff4aae0875cfc359c9d8dc1a8a15f9409cd (diff) | |
| parent | dc222b75c55645fce521c572acebb16b278169a5 (diff) | |
Merge pull request #7101 from Bond-009/imagejpg
Remove incorrect mime type image/jpg
Diffstat (limited to 'Jellyfin.Api/Controllers/ImageController.cs')
| -rw-r--r-- | Jellyfin.Api/Controllers/ImageController.cs | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/Jellyfin.Api/Controllers/ImageController.cs b/Jellyfin.Api/Controllers/ImageController.cs index 86933074d..e72589cfa 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); } |
