find head relative to asset root

This commit is contained in:
Evan Almloff committed 2023-08-18 10:57:30 -05:00
1 parent 1cbf549847
commit 7b2bf4acc5
2 files changed
+10 -5

No files matched your search

+6 -3
View File
@@ -114,9 +114,7 @@ pub(super) fn desktop_handler(
let path = PathBuf::from(&*decoded);
// If the path is relative, we'll try to serve it from the assets directory.
let mut asset = get_asset_root()
.unwrap_or_else(|| Path::new(".").to_path_buf())
.join(&path);
let mut asset = get_asset_root_or_default().join(&path);
if !asset.exists() {
asset = PathBuf::from("/").join(path);
@@ -135,6 +133,11 @@ pub(super) fn desktop_handler(
.map_err(From::from)
}
#[allow(unreachable_code)]
pub(crate) fn get_asset_root_or_default() -> PathBuf {
get_asset_root().unwrap_or_else(|| Path::new(".").to_path_buf())
}
#[allow(unreachable_code)]
fn get_asset_root() -> Option<PathBuf> {
/*