Fix release build

pull/8547/head
Bond_009 2 years ago
parent b366dc2e6e
commit cf67381e31

@ -199,6 +199,11 @@ namespace Emby.Dlna
if (headers.TryGetValue(header.Name, out StringValues value)) if (headers.TryGetValue(header.Name, out StringValues value))
{ {
if (StringValues.IsNullOrEmpty(value))
{
return false;
}
switch (header.Match) switch (header.Match)
{ {
case HeaderMatchType.Equals: case HeaderMatchType.Equals:
@ -208,7 +213,8 @@ namespace Emby.Dlna
// _logger.LogDebug("IsMatch-Substring value: {0} testValue: {1} isMatch: {2}", value, header.Value, isMatch); // _logger.LogDebug("IsMatch-Substring value: {0} testValue: {1} isMatch: {2}", value, header.Value, isMatch);
return isMatch; return isMatch;
case HeaderMatchType.Regex: case HeaderMatchType.Regex:
return Regex.IsMatch(value, header.Value, RegexOptions.IgnoreCase); // Can't be null, we checked above the switch statement
return Regex.IsMatch(value!, header.Value, RegexOptions.IgnoreCase);
default: default:
throw new ArgumentException("Unrecognized HeaderMatchType"); throw new ArgumentException("Unrecognized HeaderMatchType");
} }

@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591 #pragma warning disable CS1591
namespace Emby.Dlna namespace Emby.Dlna

@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591 #pragma warning disable CS1591
using System.Net.Http; using System.Net.Http;

@ -28,6 +28,7 @@ using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Primitives;
using Microsoft.Net.Http.Headers; using Microsoft.Net.Http.Headers;
namespace Jellyfin.Api.Controllers namespace Jellyfin.Api.Controllers
@ -2026,8 +2027,13 @@ namespace Jellyfin.Api.Controllers
} }
var acceptParam = Request.Query[HeaderNames.Accept]; 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) if (!supportsWebP)
{ {
@ -2049,7 +2055,8 @@ namespace Jellyfin.Api.Controllers
formats.Add(ImageFormat.Jpg); formats.Add(ImageFormat.Jpg);
formats.Add(ImageFormat.Png); 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); formats.Add(ImageFormat.Gif);
} }

@ -364,9 +364,9 @@ namespace Jellyfin.Api.Helpers
/// </summary> /// </summary>
/// <param name="queryString">The query string.</param> /// <param name="queryString">The query string.</param>
/// <returns>A <see cref="Dictionary{String,String}"/> containing the stream options.</returns> /// <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) foreach (var param in queryString)
{ {
if (char.IsLower(param.Key[0])) if (char.IsLower(param.Key[0]))

@ -73,7 +73,7 @@ namespace MediaBrowser.Controller.Extensions
/// </summary> /// </summary>
/// <param name="configuration">The configuration to read the setting from.</param> /// <param name="configuration">The configuration to read the setting from.</param>
/// <returns>The FFmpeg probe size option.</returns> /// <returns>The FFmpeg probe size option.</returns>
public static string GetFFmpegProbeSize(this IConfiguration configuration) public static string? GetFFmpegProbeSize(this IConfiguration configuration)
=> configuration[FfmpegProbeSizeKey]; => configuration[FfmpegProbeSizeKey];
/// <summary> /// <summary>
@ -81,7 +81,7 @@ namespace MediaBrowser.Controller.Extensions
/// </summary> /// </summary>
/// <param name="configuration">The configuration to read the setting from.</param> /// <param name="configuration">The configuration to read the setting from.</param>
/// <returns>The FFmpeg analyze duration option.</returns> /// <returns>The FFmpeg analyze duration option.</returns>
public static string GetFFmpegAnalyzeDuration(this IConfiguration configuration) public static string? GetFFmpegAnalyzeDuration(this IConfiguration configuration)
=> configuration[FfmpegAnalyzeDurationKey]; => configuration[FfmpegAnalyzeDurationKey];
/// <summary> /// <summary>
@ -105,7 +105,7 @@ namespace MediaBrowser.Controller.Extensions
/// </summary> /// </summary>
/// <param name="configuration">The configuration to read the setting from.</param> /// <param name="configuration">The configuration to read the setting from.</param>
/// <returns>The unix socket path.</returns> /// <returns>The unix socket path.</returns>
public static string GetUnixSocketPath(this IConfiguration configuration) public static string? GetUnixSocketPath(this IConfiguration configuration)
=> configuration[UnixSocketPathKey]; => configuration[UnixSocketPathKey];
/// <summary> /// <summary>
@ -113,7 +113,7 @@ namespace MediaBrowser.Controller.Extensions
/// </summary> /// </summary>
/// <param name="configuration">The configuration to read the setting from.</param> /// <param name="configuration">The configuration to read the setting from.</param>
/// <returns>The unix socket permissions.</returns> /// <returns>The unix socket permissions.</returns>
public static string GetUnixSocketPermissions(this IConfiguration configuration) public static string? GetUnixSocketPermissions(this IConfiguration configuration)
=> configuration[UnixSocketPermissionsKey]; => configuration[UnixSocketPermissionsKey];
} }
} }

Loading…
Cancel
Save