fix(core): fallback to index.html on asset loading, closes #2020 #2021 (#2022)

This commit is contained in:
Lucas Fernandes Nogueira
2021-06-20 11:47:15 -03:00
committed by GitHub
parent 70fc87a7ff
commit 8a7921e5cb
2 changed files with 10 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
---
"tauri": patch
---
Fallback to `index.html` on asset loading so router with history mode works.

View File

@@ -427,6 +427,11 @@ impl<P: Params> WindowManager<P> {
let asset_response = assets
.get(&path)
.or_else(|| {
#[cfg(debug_assertions)]
eprintln!("Asset `{}` not found; fallback to index.html", path); // TODO log::error!
assets.get("index.html")
})
.ok_or(crate::Error::AssetNotFound(path))
.map(Cow::into_owned);
match asset_response {