mirror of
https://github.com/YGGverse/btracker.git
synced 2026-04-02 18:15:38 +00:00
make sure the keyword is really empty (does not contain separators only)
This commit is contained in:
parent
e2e7ceda9d
commit
50bdb438b5
1 changed files with 39 additions and 38 deletions
|
|
@ -103,6 +103,10 @@ impl Public {
|
|||
keyword: Option<&str>,
|
||||
sort_order: Option<(Sort, Order)>,
|
||||
) -> Result<Vec<File>, Error> {
|
||||
const S: &[char] = &[
|
||||
'_', '-', ':', ';', ',', '(', ')', '[', ']', '/', '!', '?',
|
||||
' ', // @TODO make separators list optional
|
||||
];
|
||||
let mut files = Vec::with_capacity(self.default_capacity);
|
||||
for dir_entry in fs::read_dir(&self.root)? {
|
||||
let entry = dir_entry?;
|
||||
|
|
@ -111,13 +115,10 @@ impl Public {
|
|||
continue;
|
||||
}
|
||||
if let Some(k) = keyword
|
||||
&& !k.is_empty()
|
||||
&& !k.trim_matches(S).is_empty()
|
||||
&& !librqbit_core::torrent_metainfo::torrent_from_bytes(&fs::read(&path)?)
|
||||
.is_ok_and(|m: librqbit_core::torrent_metainfo::TorrentMetaV1Owned| {
|
||||
k.split([
|
||||
'_', '-', ':', ';', ',', '(', ')', '[', ']', '/', '!', '?',
|
||||
' ', // @TODO make separators list optional
|
||||
])
|
||||
k.split(S)
|
||||
.filter(|s| !s.is_empty())
|
||||
.map(|s| s.trim().to_lowercase())
|
||||
.all(|q| {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue