Browse Source

Search for attribute text

Cody Robibero 3 năm trước cách đây
mục cha
commit
3513f5a84b
1 tập tin đã thay đổi với 7 bổ sung6 xóa
  1. 7 6
      Emby.Server.Implementations/Library/PathExtensions.cs

+ 7 - 6
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(']');
             }