aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Api/Controllers/ImageController.cs
diff options
context:
space:
mode:
authorTeo Baranga <teobaranga@users.noreply.github.com>2023-01-14 20:15:50 +0000
committerGitHub <noreply@github.com>2023-01-14 13:15:50 -0700
commit56ef45ebf004cd444066335084111781b983e853 (patch)
treebf20889de0cd3aff2b2b0e24272b51474910f13e /Jellyfin.Api/Controllers/ImageController.cs
parent663854bc1e079ed5c48bf06da60b7defe7cd6669 (diff)
Fix client supported image formats (#9071)
Diffstat (limited to 'Jellyfin.Api/Controllers/ImageController.cs')
-rw-r--r--Jellyfin.Api/Controllers/ImageController.cs13
1 files changed, 3 insertions, 10 deletions
diff --git a/Jellyfin.Api/Controllers/ImageController.cs b/Jellyfin.Api/Controllers/ImageController.cs
index 534667c8c..f866655c0 100644
--- a/Jellyfin.Api/Controllers/ImageController.cs
+++ b/Jellyfin.Api/Controllers/ImageController.cs
@@ -28,7 +28,6 @@ using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Primitives;
using Microsoft.Net.Http.Headers;
namespace Jellyfin.Api.Controllers
@@ -2038,13 +2037,8 @@ namespace Jellyfin.Api.Controllers
}
var acceptParam = Request.Query[HeaderNames.Accept];
- if (StringValues.IsNullOrEmpty(acceptParam))
- {
- return Array.Empty<ImageFormat>();
- }
- // Can't be null, checked above
- var supportsWebP = SupportsFormat(supportedFormats, acceptParam!, ImageFormat.Webp, false);
+ var supportsWebP = SupportsFormat(supportedFormats, acceptParam, ImageFormat.Webp, false);
if (!supportsWebP)
{
@@ -2066,8 +2060,7 @@ namespace Jellyfin.Api.Controllers
formats.Add(ImageFormat.Jpg);
formats.Add(ImageFormat.Png);
- // Can't be null, checked above
- if (SupportsFormat(supportedFormats, acceptParam!, ImageFormat.Gif, true))
+ if (SupportsFormat(supportedFormats, acceptParam, ImageFormat.Gif, true))
{
formats.Add(ImageFormat.Gif);
}
@@ -2075,7 +2068,7 @@ namespace Jellyfin.Api.Controllers
return formats.ToArray();
}
- private bool SupportsFormat(IReadOnlyCollection<string> requestAcceptTypes, string acceptParam, ImageFormat format, bool acceptAll)
+ private bool SupportsFormat(IReadOnlyCollection<string> requestAcceptTypes, string? acceptParam, ImageFormat format, bool acceptAll)
{
if (requestAcceptTypes.Contains(format.GetMimeType()))
{