From 1ed25ebd9a11f3fc1838e347a34621dcde0b7bd5 Mon Sep 17 00:00:00 2001 From: Greenback Date: Wed, 16 Dec 2020 22:36:25 +0000 Subject: [PATCH] Corrections as recommended. --- .../Updates/InstallationManager.cs | 5 ++--- Jellyfin.Api/Controllers/PluginsController.cs | 16 +++++++++------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/Emby.Server.Implementations/Updates/InstallationManager.cs b/Emby.Server.Implementations/Updates/InstallationManager.cs index 7cab77c85d..70424369bd 100644 --- a/Emby.Server.Implementations/Updates/InstallationManager.cs +++ b/Emby.Server.Implementations/Updates/InstallationManager.cs @@ -92,7 +92,7 @@ namespace Emby.Server.Implementations.Updates _httpClientFactory = httpClientFactory; _config = config; _zipClient = zipClient; - _jsonSerializerOptions = JsonDefaults.GetCamelCaseOptions(); + _jsonSerializerOptions = JsonDefaults.GetOptions(); _pluginManager = pluginManager; } @@ -104,8 +104,7 @@ namespace Emby.Server.Implementations.Updates { try { - List? packages; - packages = await _httpClientFactory.CreateClient(NamedClient.Default) + List? packages = await _httpClientFactory.CreateClient(NamedClient.Default) .GetFromJsonAsync>(new Uri(manifest), _jsonSerializerOptions, cancellationToken).ConfigureAwait(false); if (packages == null) diff --git a/Jellyfin.Api/Controllers/PluginsController.cs b/Jellyfin.Api/Controllers/PluginsController.cs index 4f65e18e15..6db74571cc 100644 --- a/Jellyfin.Api/Controllers/PluginsController.cs +++ b/Jellyfin.Api/Controllers/PluginsController.cs @@ -217,8 +217,13 @@ namespace Jellyfin.Api.Controllers plugin = plugins.OrderBy(p => p.Manifest.Status).FirstOrDefault(); } - _installationManager.UninstallPlugin(plugin!); - return NoContent(); + if (plugin != null) + { + _installationManager.UninstallPlugin(plugin!); + return NoContent(); + } + + return NotFound(); } /// @@ -303,10 +308,7 @@ namespace Jellyfin.Api.Controllers || plugin.Manifest.ImageUrl == null || !System.IO.File.Exists(imgPath)) { - // Use a blank image. - var type = GetType(); - var stream = type.Assembly.GetManifestResourceStream(type.Namespace + ".Plugins.blank.png"); - return File(stream, "image/png"); + return NotFound(); } imgPath = Path.Combine(plugin.Path, plugin.Manifest.ImageUrl); @@ -333,7 +335,7 @@ namespace Jellyfin.Api.Controllers if (plugin != null) { - return Ok(plugin.Manifest); + return plugin.Manifest; } return NotFound();