diff options
| author | Claus Vium <cvium@users.noreply.github.com> | 2021-04-12 19:54:32 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-04-12 19:54:32 +0200 |
| commit | dc4714fe4098eed42114adc3455f4a2982cc18d6 (patch) | |
| tree | e58c006e0bac2547bbe3cbf8750e98244b5fdcfd /Jellyfin.Api/Controllers/ImageController.cs | |
| parent | cc59abd54e7be6a58187bfb3d01dbe0ec7ea9a1d (diff) | |
fix webp compatibility testing (#5787)
Diffstat (limited to 'Jellyfin.Api/Controllers/ImageController.cs')
| -rw-r--r-- | Jellyfin.Api/Controllers/ImageController.cs | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/Jellyfin.Api/Controllers/ImageController.cs b/Jellyfin.Api/Controllers/ImageController.cs index 36facf75a..8f7500ac6 100644 --- a/Jellyfin.Api/Controllers/ImageController.cs +++ b/Jellyfin.Api/Controllers/ImageController.cs @@ -1859,17 +1859,15 @@ namespace Jellyfin.Api.Controllers private ImageFormat[] GetClientSupportedFormats() { - var acceptTypes = Request.Headers[HeaderNames.Accept]; - var supportedFormats = new List<string>(); - if (acceptTypes.Count > 0) + var supportedFormats = Request.Headers.GetCommaSeparatedValues(HeaderNames.Accept); + for (var i = 0; i < supportedFormats.Length; i++) { - foreach (var type in acceptTypes) + // Remove charsets etc. (anything after semi-colon) + var type = supportedFormats[i]; + int index = type.IndexOf(';', StringComparison.Ordinal); + if (index != -1) { - int index = type.IndexOf(';', StringComparison.Ordinal); - if (index != -1) - { - supportedFormats.Add(type.Substring(0, index)); - } + supportedFormats[i] = type.Substring(0, index); } } |
