aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Api/Controllers
diff options
context:
space:
mode:
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 4e8c01577..b1c576c33 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 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);
}