diff --git a/Emby.Server.Implementations/Library/PathExtensions.cs b/Emby.Server.Implementations/Library/PathExtensions.cs index 8ce054c38..73a658186 100644 --- a/Emby.Server.Implementations/Library/PathExtensions.cs +++ b/Emby.Server.Implementations/Library/PathExtensions.cs @@ -29,18 +29,19 @@ namespace Emby.Server.Implementations.Library } var openBracketIndex = str.IndexOf('['); - var equalsIndex = str.IndexOf('='); + var attributeIndex = str.IndexOf(attribute); var closingBracketIndex = str.IndexOf(']'); - while (openBracketIndex < equalsIndex && equalsIndex < closingBracketIndex) + while (openBracketIndex < attributeIndex && attributeIndex < closingBracketIndex) { - if (str[(openBracketIndex + 1)..equalsIndex].Equals(attribute, StringComparison.OrdinalIgnoreCase)) + if (openBracketIndex + 1 == attributeIndex + && str[attributeIndex + attribute.Length] == '=') { - return str[(equalsIndex + 1)..closingBracketIndex].Trim().ToString(); + return str[(attributeIndex + attribute.Length + 1)..closingBracketIndex].Trim().ToString(); } - str = str[(closingBracketIndex+ 1)..]; + str = str[(closingBracketIndex + 1)..]; openBracketIndex = str.IndexOf('['); - equalsIndex = str.IndexOf('='); + attributeIndex = str.IndexOf(attribute); closingBracketIndex = str.IndexOf(']'); }