diff options
| author | JP Dillingham <jp@dillingham.me> | 2024-03-04 07:12:01 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-03-04 07:12:01 -0600 |
| commit | 3af712067a03640fd251f804ca532bd4cd5f7b10 (patch) | |
| tree | 5e0ce1932f9d959b17d49fbc0a32b27434f13419 /src/slskd/Shares | |
| parent | b39be34b05d6dd8e8d57e06512263d30634b9e1a (diff) | |
| parent | 264019f11042fbffd789560635bf8943d4de9aa2 (diff) | |
| download | slskd-3af712067a03640fd251f804ca532bd4cd5f7b10.tar.gz | |
Merge branch 'master' into chore/codestyle
Diffstat (limited to 'src/slskd/Shares')
| -rw-r--r-- | src/slskd/Shares/SqliteShareRepository.cs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/slskd/Shares/SqliteShareRepository.cs b/src/slskd/Shares/SqliteShareRepository.cs index 882ede74..029d74b8 100644 --- a/src/slskd/Shares/SqliteShareRepository.cs +++ b/src/slskd/Shares/SqliteShareRepository.cs @@ -539,6 +539,17 @@ namespace slskd.Shares while (reader.Read()) { var filename = reader.GetString(0); + + // SQLite takes care of matching on tokens, but unfortunately doesn't work in cases where an exclusion appears as a substring. + // example: the token matching works to exclude the result "foo bar baz" given a "bar" exclusion, but does not exclude "foo xbarx baz" + // for this reason we must iterate over the exclusion list and ensure none appear as substrings + // **CAUTION** performance of this will degrade exponentially as the list of exclusions grows + if (query.Exclusions.Any(x => filename.Contains(x, StringComparison.OrdinalIgnoreCase))) + { + Log.Debug("Dropping excluded filename {File}", filename); + continue; + } + var code = reader.GetInt32(1); var size = reader.GetInt64(2); var extension = reader.GetString(3); |
