Address comments

This commit is contained in:
Bond_009 2021-09-25 18:15:46 +02:00
parent 5e8d58a6a6
commit 4643fd5dcb
4 changed files with 9 additions and 7 deletions

View File

@ -52,10 +52,14 @@ namespace Jellyfin.Server.Middleware
return;
}
var pairs = new Dictionary<string, StringValues>();
var queryString = HttpUtility.UrlDecode(key).SpanSplit('&');
if (!key.Contains('='))
{
_store = value;
return;
}
foreach (var pair in queryString)
var pairs = new Dictionary<string, StringValues>();
foreach (var pair in key.SpanSplit('&'))
{
var i = pair.IndexOf('=');
if (i == -1)

View File

@ -38,7 +38,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
subRip.LoadSubtitle(subtitle, lines, "untitled");
if (subRip.ErrorCount > 0)
{
_logger.LogError("{ErrorCount} errors encountered while parsing subtitle.", subRip.ErrorCount);
_logger.LogError("{ErrorCount} errors encountered while parsing subtitle", subRip.ErrorCount);
}
var trackInfo = new SubtitleTrackInfo();

View File

@ -21,6 +21,7 @@ namespace Jellyfin.Server.Integration.Tests
[InlineData("a=1", "a=1")] // won't be processed as it has a value
[InlineData("a%3D1%26b%3D2%26c%3D3", "a=1&b=2&c=3")] // will be processed.
[InlineData("a=b&a=c", "a=b")]
[InlineData("a%3D1", "a=1")]
[InlineData("a%3Db%26a%3Dc", "a=b")]
public async Task Ensure_Decoding_Of_Urls_Is_Working(string sourceUrl, string unencodedUrl)
{

View File

@ -12,9 +12,6 @@ namespace Jellyfin.Server.Tests
{
[Theory]
[InlineData("e0a72cb2a2c7", "e0a72cb2a2c7")] // isn't encoded
[InlineData("random+test", "random test")] // encoded
[InlineData("random%20test", "random test")] // encoded
[InlineData("++", " ")] // encoded
public static void EmptyValueTest(string query, string key)
{
var dict = new Dictionary<string, StringValues>