Browse Source

fix(core): fallback to `{asset}/index.html` before `index.html`, closes #2328 (#2329)

Amr Bashir 4 years ago
parent
commit
d22da650ef
2 changed files with 6 additions and 0 deletions
  1. 5 0
      .changes/core-asset-fallback.md
  2. 1 0
      core/tauri/src/manager.rs

+ 5 - 0
.changes/core-asset-fallback.md

@@ -0,0 +1,5 @@
+---
+"tauri": patch
+---
+
+Assets will now fallback to `<uri>/index.html` before `/index.html`, allowing anchor links to work as expected.

+ 1 - 0
core/tauri/src/manager.rs

@@ -353,6 +353,7 @@ impl<R: Runtime> WindowManager<R> {
 
         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!