mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-12-15 21:43:03 +03:00
Merge remote-tracking branch 'upstream/master' into integration-tests
This commit is contained in:
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Net.Mime;
|
||||
using MediaBrowser.Common.Extensions;
|
||||
using MediaBrowser.Common.Net;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Http.Extensions;
|
||||
@@ -222,14 +223,14 @@ namespace Emby.Server.Implementations.SocketSharp
|
||||
pi = pi.Slice(1);
|
||||
}
|
||||
|
||||
format = LeftPart(pi, '/');
|
||||
format = pi.LeftPart('/');
|
||||
if (format.Length > FormatMaxLength)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
format = LeftPart(format, '.');
|
||||
format = format.LeftPart('.');
|
||||
if (format.Contains("json", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return "application/json";
|
||||
@@ -241,16 +242,5 @@ namespace Emby.Server.Implementations.SocketSharp
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static ReadOnlySpan<char> LeftPart(ReadOnlySpan<char> strVal, char needle)
|
||||
{
|
||||
if (strVal == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var pos = strVal.IndexOf(needle);
|
||||
return pos == -1 ? strVal : strVal.Slice(0, pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user