mirror of
https://github.com/YGGverse/btracker.git
synced 2026-03-31 17:15:31 +00:00
handle fs read errors
This commit is contained in:
parent
4f6af5f03b
commit
6ab12dbaa4
1 changed files with 16 additions and 19 deletions
|
|
@ -110,29 +110,26 @@ impl Public {
|
||||||
if !p.is_file() || p.extension().is_none_or(|e| e != EXTENSION) {
|
if !p.is_file() || p.extension().is_none_or(|e| e != EXTENSION) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if keyword.is_some_and(|k| {
|
if let Some(k) = keyword
|
||||||
!k.is_empty()
|
&& !k.is_empty()
|
||||||
&& !librqbit_core::torrent_metainfo::torrent_from_bytes(
|
&& !librqbit_core::torrent_metainfo::torrent_from_bytes(&fs::read(&p)?).is_ok_and(
|
||||||
&fs::read(e.path()).unwrap(),
|
|m: librqbit_core::torrent_metainfo::TorrentMetaV1Owned| {
|
||||||
)
|
m.info_hash.as_string().contains(k)
|
||||||
.is_ok_and(
|
|| m.info.name.is_some_and(|n| n.to_string().contains(k))
|
||||||
|m: librqbit_core::torrent_metainfo::TorrentMetaV1Owned| {
|
|| m.info.files.is_some_and(|f| {
|
||||||
m.info_hash.as_string().contains(k)
|
f.iter().any(|f| {
|
||||||
|| m.info.name.is_some_and(|n| n.to_string().contains(k))
|
let mut p = PathBuf::new();
|
||||||
|| m.info.files.is_some_and(|f| {
|
f.full_path(&mut p)
|
||||||
f.iter().any(|f| {
|
.is_ok_and(|_| p.to_string_lossy().contains(k))
|
||||||
let mut p = PathBuf::new();
|
|
||||||
f.full_path(&mut p)
|
|
||||||
.is_ok_and(|_| p.to_string_lossy().contains(k))
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
},
|
})
|
||||||
) // @TODO implement fast in-memory search index
|
},
|
||||||
}) {
|
)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
f.push(File {
|
f.push(File {
|
||||||
path: e.path(),
|
path: p,
|
||||||
modified: e.metadata()?.modified()?,
|
modified: e.metadata()?.modified()?,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue