refactor: make partition heuristic predicate a positive match (#3526)

This commit is contained in:
Gabriel Wicke 2026-01-07 10:25:50 -08:00 committed by GitHub
parent c9327ca851
commit 30ac041d9e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 2 deletions

View file

@ -14,9 +14,11 @@ pub struct Partition {
}
impl Partition {
// Match mount types that do not reliably emit change notifications, or update directory
// metadata on changes, and should be refreshed frequently / heuristically.
pub fn heuristic(&self) -> bool {
let b: &[u8] = self.fstype.as_ref().map_or(b"", |s| s.as_encoded_bytes());
!matches!(b, b"exfat" | b"fuse.rclone")
matches!(b, b"exfat" | b"fuse.rclone")
}
#[rustfmt::skip]

View file

@ -70,7 +70,7 @@ impl VfsFiles for Files {
use std::io::ErrorKind;
match Cha::from_url(dir).await {
Ok(c) if !c.is_dir() => FilesOp::issue_error(dir, ErrorKind::NotADirectory).await,
Ok(c) if c.hits(cha) && PARTITIONS.read().heuristic(cha) => {}
Ok(c) if c.hits(cha) && !PARTITIONS.read().heuristic(cha) => {}
Ok(c) => return Some(c),
Err(e) => FilesOp::issue_error(dir, e).await,
}