aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJP Dillingham <jpdillingham@gmail.com>2022-12-18 15:53:06 -0600
committerJP Dillingham <jpdillingham@gmail.com>2022-12-18 15:53:06 -0600
commit88e83d6b0fdeb1d3a5500ab45795ec3a4a35eb7c (patch)
treebe0a8d918ef101a0e27ef9fddd21166bba46b3ae /src
parentbbe4e17c499414d0ed7bed983075cdfeae1984e3 (diff)
downloadslskd-88e83d6b0fdeb1d3a5500ab45795ec3a4a35eb7c.tar.gz
selectively ignore case when compiling search filters
Diffstat (limited to 'src')
-rw-r--r--src/slskd/Application.cs12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/slskd/Application.cs b/src/slskd/Application.cs
index 71fb140d..44b7c627 100644
--- a/src/slskd/Application.cs
+++ b/src/slskd/Application.cs
@@ -118,7 +118,16 @@ namespace slskd
PreviousOptions = OptionsMonitor.CurrentValue;
- CompiledSearchResponseFilters = OptionsAtStartup.Filters.Search.Request.Select(f => new Regex(f, RegexOptions.Compiled));
+ Flags = Program.Flags;
+
+ var regexOptions = RegexOptions.Compiled;
+
+ if (!Flags.CaseSensitiveRegEx)
+ {
+ regexOptions |= RegexOptions.IgnoreCase;
+ }
+
+ CompiledSearchResponseFilters = OptionsAtStartup.Filters.Search.Request.Select(f => new Regex(f, regexOptions));
State = state;
State.OnChange(state => State_OnChange(state));
@@ -203,6 +212,7 @@ namespace slskd
private IMemoryCache Cache { get; set; } = new MemoryCache(new MemoryCacheOptions());
private IEnumerable<Regex> CompiledSearchResponseFilters { get; set; }
private IEnumerable<Guid> ActiveDownloadIdsAtPreviousShutdown { get; set; } = Enumerable.Empty<Guid>();
+ private Options.FlagsOptions Flags { get; set; }
public void CollectGarbage()
{