Sidecar fixes
This commit is contained in:
@@ -47,14 +47,20 @@ impl DataSource for Arc<DirDataSource> {
|
|||||||
source: Arc::clone(self),
|
source: Arc::clone(self),
|
||||||
mime: mime_guess::from_path(&key).first_or_octet_stream(),
|
mime: mime_guess::from_path(&key).first_or_octet_stream(),
|
||||||
path: key.clone(),
|
path: key.clone(),
|
||||||
sidecar: self.sidecars.then(|| {
|
sidecar: self
|
||||||
Box::new(Item::File {
|
.sidecars
|
||||||
source: Arc::clone(self),
|
.then(|| {
|
||||||
mime: mime_guess::from_path(key.with_extension("toml")).first_or_octet_stream(),
|
let sidecar_path = key.with_extension("toml");
|
||||||
path: key.with_extension("toml"),
|
sidecar_path.is_file().then(|| {
|
||||||
sidecar: None,
|
Box::new(Item::File {
|
||||||
|
source: Arc::clone(self),
|
||||||
|
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(),
|
mime: mime_guess::from_path(&path).first_or_octet_stream(),
|
||||||
path: path.clone(),
|
path: path.clone(),
|
||||||
|
|
||||||
sidecar: source.sidecars.then(|| {
|
sidecar: source
|
||||||
Box::new(Item::File {
|
.sidecars
|
||||||
source: Arc::clone(&source),
|
.then(|| {
|
||||||
mime: mime_guess::from_path(path.with_extension("toml"))
|
let sidecar_path = path.with_extension("toml");
|
||||||
.first_or_octet_stream(),
|
sidecar_path.is_file().then(|| {
|
||||||
path: path.with_extension("toml"),
|
Box::new(Item::File {
|
||||||
sidecar: None,
|
source: Arc::clone(&source),
|
||||||
|
mime: mime_guess::from_path(&sidecar_path)
|
||||||
|
.first_or_octet_stream(),
|
||||||
|
path: sidecar_path,
|
||||||
|
sidecar: None,
|
||||||
|
})
|
||||||
|
})
|
||||||
})
|
})
|
||||||
}),
|
.flatten(),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user