fix webp compatibility testing (#5787)

This commit is contained in:
Claus Vium 2021-04-12 19:54:32 +02:00 committed by GitHub
parent cc59abd54e
commit dc4714fe40
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1859,17 +1859,15 @@ namespace Jellyfin.Api.Controllers
private ImageFormat[] GetClientSupportedFormats() private ImageFormat[] GetClientSupportedFormats()
{ {
var acceptTypes = Request.Headers[HeaderNames.Accept]; var supportedFormats = Request.Headers.GetCommaSeparatedValues(HeaderNames.Accept);
var supportedFormats = new List<string>(); for (var i = 0; i < supportedFormats.Length; i++)
if (acceptTypes.Count > 0)
{ {
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); supportedFormats[i] = type.Substring(0, index);
if (index != -1)
{
supportedFormats.Add(type.Substring(0, index));
}
} }
} }