aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Api
diff options
context:
space:
mode:
authorBond_009 <bond.009@outlook.com>2022-11-08 21:13:57 +0100
committerBond_009 <bond.009@outlook.com>2022-12-07 16:44:00 +0100
commitcf67381e310789f5c2f594b51c6170cf7e9019d0 (patch)
tree170ab67cfa9527005d79b2840a54a824b6a69807 /Jellyfin.Api
parentb366dc2e6e5be2b93f2b6fcc4549a32b655c3806 (diff)
Fix release build
Diffstat (limited to 'Jellyfin.Api')
-rw-r--r--Jellyfin.Api/Controllers/ImageController.cs11
-rw-r--r--Jellyfin.Api/Helpers/StreamingHelpers.cs4
2 files changed, 11 insertions, 4 deletions
diff --git a/Jellyfin.Api/Controllers/ImageController.cs b/Jellyfin.Api/Controllers/ImageController.cs
index 260b9536e..49342ad5c 100644
--- a/Jellyfin.Api/Controllers/ImageController.cs
+++ b/Jellyfin.Api/Controllers/ImageController.cs
@@ -28,6 +28,7 @@ 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
@@ -2026,8 +2027,13 @@ namespace Jellyfin.Api.Controllers
}
var acceptParam = Request.Query[HeaderNames.Accept];
+ if (StringValues.IsNullOrEmpty(acceptParam))
+ {
+ return Array.Empty<ImageFormat>();
+ }
- var supportsWebP = SupportsFormat(supportedFormats, acceptParam, ImageFormat.Webp, false);
+ // Can't be null, checked above
+ var supportsWebP = SupportsFormat(supportedFormats, acceptParam!, ImageFormat.Webp, false);
if (!supportsWebP)
{
@@ -2049,7 +2055,8 @@ namespace Jellyfin.Api.Controllers
formats.Add(ImageFormat.Jpg);
formats.Add(ImageFormat.Png);
- if (SupportsFormat(supportedFormats, acceptParam, ImageFormat.Gif, true))
+ // Can't be null, checked above
+ if (SupportsFormat(supportedFormats, acceptParam!, ImageFormat.Gif, true))
{
formats.Add(ImageFormat.Gif);
}
diff --git a/Jellyfin.Api/Helpers/StreamingHelpers.cs b/Jellyfin.Api/Helpers/StreamingHelpers.cs
index 1decbcd92..d4fc9c020 100644
--- a/Jellyfin.Api/Helpers/StreamingHelpers.cs
+++ b/Jellyfin.Api/Helpers/StreamingHelpers.cs
@@ -364,9 +364,9 @@ namespace Jellyfin.Api.Helpers
/// </summary>
/// <param name="queryString">The query string.</param>
/// <returns>A <see cref="Dictionary{String,String}"/> containing the stream options.</returns>
- private static Dictionary<string, string> ParseStreamOptions(IQueryCollection queryString)
+ private static Dictionary<string, string?> ParseStreamOptions(IQueryCollection queryString)
{
- Dictionary<string, string> streamOptions = new Dictionary<string, string>();
+ Dictionary<string, string?> streamOptions = new Dictionary<string, string?>();
foreach (var param in queryString)
{
if (char.IsLower(param.Key[0]))