aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/Library/PathExtensions.cs
diff options
context:
space:
mode:
authorShadowghost <Ghost_of_Stone@web.de>2026-02-07 14:06:53 +0100
committerShadowghost <Ghost_of_Stone@web.de>2026-02-07 14:06:53 +0100
commit00dd84035ee39b36da343e0d98d7dc83246c5f89 (patch)
treeb670a0b83ba5ca782501200c4c111b000663b32d /Emby.Server.Implementations/Library/PathExtensions.cs
parentf5d966fcc3eb3c5f8aa39a22caa8cf615029e1c5 (diff)
parentfead4acae121c1a2edacebbba860bdf4f6b56d25 (diff)
Merge remote-tracking branch 'upstream/master' into perf-rebased
Diffstat (limited to 'Emby.Server.Implementations/Library/PathExtensions.cs')
-rw-r--r--Emby.Server.Implementations/Library/PathExtensions.cs24
1 files changed, 17 insertions, 7 deletions
diff --git a/Emby.Server.Implementations/Library/PathExtensions.cs b/Emby.Server.Implementations/Library/PathExtensions.cs
index 21e7079d88..fc63251ad0 100644
--- a/Emby.Server.Implementations/Library/PathExtensions.cs
+++ b/Emby.Server.Implementations/Library/PathExtensions.cs
@@ -37,15 +37,25 @@ namespace Emby.Server.Implementations.Library
while (attributeIndex > -1 && attributeIndex < maxIndex)
{
var attributeEnd = attributeIndex + attribute.Length;
- if (attributeIndex > 0
- && str[attributeIndex - 1] == '['
- && (str[attributeEnd] == '=' || str[attributeEnd] == '-'))
+ if (attributeIndex > 0)
{
- var closingIndex = str[attributeEnd..].IndexOf(']');
- // Must be at least 1 character before the closing bracket.
- if (closingIndex > 1)
+ var attributeOpener = str[attributeIndex - 1];
+ var attributeCloser = attributeOpener switch
{
- return str[(attributeEnd + 1)..(attributeEnd + closingIndex)].Trim().ToString();
+ '[' => ']',
+ '(' => ')',
+ '{' => '}',
+ _ => '\0'
+ };
+ if (attributeCloser != '\0' && (str[attributeEnd] == '=' || str[attributeEnd] == '-'))
+ {
+ var closingIndex = str[attributeEnd..].IndexOf(attributeCloser);
+
+ // Must be at least 1 character before the closing bracket.
+ if (closingIndex > 1)
+ {
+ return str[(attributeEnd + 1)..(attributeEnd + closingIndex)].Trim().ToString();
+ }
}
}