diff --git a/Emby.Server.Implementations/Library/PathExtensions.cs b/Emby.Server.Implementations/Library/PathExtensions.cs index 3fcbb4d65f..6f61dc7135 100644 --- a/Emby.Server.Implementations/Library/PathExtensions.cs +++ b/Emby.Server.Implementations/Library/PathExtensions.cs @@ -40,7 +40,8 @@ namespace Emby.Server.Implementations.Library && str[attributeEnd] == '=') { var closingIndex = str[attributeEnd..].IndexOf(']'); - if (closingIndex != -1) + // Must be at least 1 character before the closing bracket. + if (closingIndex > 1) { return str[(attributeEnd + 1)..(attributeEnd + closingIndex)].Trim().ToString(); }