From d22da650ef5b51ab7dd0e45dd9527a9c5a01f84d Mon Sep 17 00:00:00 2001 From: Amr Bashir <48618675+amrbashir@users.noreply.github.com> Date: Mon, 2 Aug 2021 04:46:13 +0200 Subject: [PATCH] fix(core): fallback to `{asset}/index.html` before `index.html`, closes #2328 (#2329) --- .changes/core-asset-fallback.md | 5 +++++ core/tauri/src/manager.rs | 1 + 2 files changed, 6 insertions(+) create mode 100644 .changes/core-asset-fallback.md diff --git a/.changes/core-asset-fallback.md b/.changes/core-asset-fallback.md new file mode 100644 index 000000000..2a3da7765 --- /dev/null +++ b/.changes/core-asset-fallback.md @@ -0,0 +1,5 @@ +--- +"tauri": patch +--- + +Assets will now fallback to `/index.html` before `/index.html`, allowing anchor links to work as expected. diff --git a/core/tauri/src/manager.rs b/core/tauri/src/manager.rs index 0c953b3b9..0c6b4277d 100644 --- a/core/tauri/src/manager.rs +++ b/core/tauri/src/manager.rs @@ -353,6 +353,7 @@ impl WindowManager { let asset_response = assets .get(&path.as_str().into()) + .or_else(|| assets.get(&format!("{}/index.html", path.as_str()).into())) .or_else(|| { #[cfg(debug_assertions)] eprintln!("Asset `{}` not found; fallback to index.html", path); // TODO log::error!