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 (StringValues.IsNullOrEmpty(value))
{
return false;
}
switch (header.Match)
{
case HeaderMatchType.Equals:
@ -208,7 +213,8 @@ namespace Emby.Dlna
// _logger.LogDebug("IsMatch-Substring value: {0} testValue: {1} isMatch: {2}", value, header.Value, isMatch);
return isMatch;
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:
throw new ArgumentException("Unrecognized HeaderMatchType");
}

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

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

@ -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);
}

@ -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]))

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

Loading…
Cancel
Save