diff options
| author | David Ullmer <davidullmer@outlook.de> | 2021-08-18 14:22:01 +0200 |
|---|---|---|
| committer | Cody Robibero <cody@robibe.ro> | 2022-01-04 08:20:16 -0700 |
| commit | 9e0958d8224ef3fa51893fd5a38cc57104f32422 (patch) | |
| tree | 16ab598f75bd48f06d8c4b8033239b5d494af0b0 /Jellyfin.Api/Controllers/ImageController.cs | |
| parent | 9e23af5636adf7b9c657b125c40c2c9846aef112 (diff) | |
Apply suggestions from code review
Diffstat (limited to 'Jellyfin.Api/Controllers/ImageController.cs')
| -rw-r--r-- | Jellyfin.Api/Controllers/ImageController.cs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/Jellyfin.Api/Controllers/ImageController.cs b/Jellyfin.Api/Controllers/ImageController.cs index 3b2fc98e7..24059cddd 100644 --- a/Jellyfin.Api/Controllers/ImageController.cs +++ b/Jellyfin.Api/Controllers/ImageController.cs @@ -1803,15 +1803,14 @@ namespace Jellyfin.Api.Controllers { await using var memoryStream = await GetMemoryStream(Request.Body).ConfigureAwait(false); - // Handle image/png; charset=utf-8 - var mimeType = Request.ContentType.Split(';').FirstOrDefault(); + var mimeType = MediaTypeHeaderValue.Parse(Request.ContentType).MediaType; - if (mimeType == null) + if (!mimeType.HasValue) { return BadRequest("Error reading mimetype from uploaded image"); } - var filePath = Path.Combine(_appPaths.DataPath, "splashscreen-upload" + MimeTypes.ToExtension(mimeType)); + var filePath = Path.Combine(_appPaths.DataPath, "splashscreen-upload" + MimeTypes.ToExtension(mimeType.Value)); var brandingOptions = _serverConfigurationManager.GetConfiguration<BrandingOptions>("branding"); brandingOptions.SplashscreenLocation = filePath; _serverConfigurationManager.SaveConfiguration("branding", brandingOptions); |
