Sidecar fixes

This commit is contained in:
2026-03-16 09:54:31 -07:00
parent 1d90306408
commit 2a2d5af36c

View File

@@ -47,14 +47,20 @@ impl DataSource for Arc<DirDataSource> {
source: Arc::clone(self),
mime: mime_guess::from_path(&key).first_or_octet_stream(),
path: key.clone(),
sidecar: self.sidecars.then(|| {
sidecar: self
.sidecars
.then(|| {
let sidecar_path = key.with_extension("toml");
sidecar_path.is_file().then(|| {
Box::new(Item::File {
source: Arc::clone(self),
mime: mime_guess::from_path(key.with_extension("toml")).first_or_octet_stream(),
path: key.with_extension("toml"),
mime: mime_guess::from_path(&sidecar_path).first_or_octet_stream(),
path: sidecar_path,
sidecar: None,
})
}),
})
})
.flatten(),
}));
}
@@ -91,15 +97,21 @@ impl DataSource for Arc<DirDataSource> {
mime: mime_guess::from_path(&path).first_or_octet_stream(),
path: path.clone(),
sidecar: source.sidecars.then(|| {
sidecar: source
.sidecars
.then(|| {
let sidecar_path = path.with_extension("toml");
sidecar_path.is_file().then(|| {
Box::new(Item::File {
source: Arc::clone(&source),
mime: mime_guess::from_path(path.with_extension("toml"))
mime: mime_guess::from_path(&sidecar_path)
.first_or_octet_stream(),
path: path.with_extension("toml"),
path: sidecar_path,
sidecar: None,
})
}),
})
})
.flatten(),
},
};