diff options
| author | Bond_009 <bond.009@outlook.com> | 2022-11-08 21:13:57 +0100 |
|---|---|---|
| committer | Bond_009 <bond.009@outlook.com> | 2022-12-07 16:44:00 +0100 |
| commit | cf67381e310789f5c2f594b51c6170cf7e9019d0 (patch) | |
| tree | 170ab67cfa9527005d79b2840a54a824b6a69807 | |
| parent | b366dc2e6e5be2b93f2b6fcc4549a32b655c3806 (diff) | |
Fix release build
| -rw-r--r-- | Emby.Dlna/DlnaManager.cs | 8 | ||||
| -rw-r--r-- | Emby.Dlna/IDlnaEventManager.cs | 1 | ||||
| -rw-r--r-- | Emby.Dlna/Service/BaseService.cs | 1 | ||||
| -rw-r--r-- | Jellyfin.Api/Controllers/ImageController.cs | 11 | ||||
| -rw-r--r-- | Jellyfin.Api/Helpers/StreamingHelpers.cs | 4 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Extensions/ConfigurationExtensions.cs | 8 |
6 files changed, 24 insertions, 9 deletions
diff --git a/Emby.Dlna/DlnaManager.cs b/Emby.Dlna/DlnaManager.cs index f23c5f970..99b3e6e7e 100644 --- a/Emby.Dlna/DlnaManager.cs +++ b/Emby.Dlna/DlnaManager.cs @@ -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"); } diff --git a/Emby.Dlna/IDlnaEventManager.cs b/Emby.Dlna/IDlnaEventManager.cs index eea030d6d..bb1eeb963 100644 --- a/Emby.Dlna/IDlnaEventManager.cs +++ b/Emby.Dlna/IDlnaEventManager.cs @@ -1,3 +1,4 @@ +#nullable disable #pragma warning disable CS1591 namespace Emby.Dlna diff --git a/Emby.Dlna/Service/BaseService.cs b/Emby.Dlna/Service/BaseService.cs index 68fd98758..67e7bf6a6 100644 --- a/Emby.Dlna/Service/BaseService.cs +++ b/Emby.Dlna/Service/BaseService.cs @@ -1,3 +1,4 @@ +#nullable disable #pragma warning disable CS1591 using System.Net.Http; 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])) diff --git a/MediaBrowser.Controller/Extensions/ConfigurationExtensions.cs b/MediaBrowser.Controller/Extensions/ConfigurationExtensions.cs index 5a7110261..3b5e8ece7 100644 --- a/MediaBrowser.Controller/Extensions/ConfigurationExtensions.cs +++ b/MediaBrowser.Controller/Extensions/ConfigurationExtensions.cs @@ -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]; } } |
