aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJP Dillingham <jp@dillingham.me>2026-04-22 18:46:50 -0500
committerJP Dillingham <jp@dillingham.me>2026-04-22 18:46:50 -0500
commita379b400b62c7c29fb3ace854b2d8acfdeeee26e (patch)
tree55eaa303a2ca560ddf78ee1b09a04de7f618801a
parentaaf49f0a498e6597668dac2b812431ab28dfcb51 (diff)
downloadslskd-a379b400b62c7c29fb3ace854b2d8acfdeeee26e.tar.gz
check compiled patterns
-rw-r--r--src/slskd/Users/UserService.cs14
1 files changed, 3 insertions, 11 deletions
diff --git a/src/slskd/Users/UserService.cs b/src/slskd/Users/UserService.cs
index 469680cf..ee117855 100644
--- a/src/slskd/Users/UserService.cs
+++ b/src/slskd/Users/UserService.cs
@@ -319,18 +319,10 @@ namespace slskd.Users
return true;
}
- // check username patterns (regex). respects the same case sensitivity flag used by other
- // user-defined regular expressions throughout the application.
- if (blacklist.Patterns.Length > 0)
+ // check to see if the username matches any patterns
+ if (CompiledBlacklistPatterns.Any(pattern => pattern.IsMatch(username)))
{
- var regexOptions = OptionsMonitor.CurrentValue.Flags.CaseSensitiveRegEx
- ? RegexOptions.None
- : RegexOptions.IgnoreCase;
-
- if (blacklist.Patterns.Any(p => Regex.IsMatch(username, p, regexOptions)))
- {
- return true;
- }
+ return true;
}
// check the user-curated list of blacklisted CIDRs that exists along with the list of