diff --git a/Emby.Server.Implementations/Library/IgnorePatterns.cs b/Emby.Server.Implementations/Library/IgnorePatterns.cs
index cd5c5f19db..6e6ef1359a 100644
--- a/Emby.Server.Implementations/Library/IgnorePatterns.cs
+++ b/Emby.Server.Implementations/Library/IgnorePatterns.cs
@@ -1,3 +1,6 @@
+#nullable enable
+
+using System;
using System.Linq;
using DotNet.Globbing;
@@ -88,9 +91,18 @@ namespace Emby.Server.Implementations.Library
///
/// The path to test.
/// Whether to ignore the path.
- public static bool ShouldIgnore(string path)
+ public static bool ShouldIgnore(ReadOnlySpan path)
{
- return _globs.Any(g => g.IsMatch(path));
+ int len = _globs.Length;
+ for (int i = 0; i < len; i++)
+ {
+ if (_globs[i].IsMatch(path))
+ {
+ return true;
+ }
+ }
+
+ return false;
}
}
}