mirror of
https://github.com/tauri-apps/tauri.git
synced 2026-04-03 10:11:15 +02:00
This commit is contained in:
committed by
GitHub
parent
47be3514a7
commit
7864d41de8
5
.changes/asset-default-ext-fallback.md
Normal file
5
.changes/asset-default-ext-fallback.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"tauri": patch
|
||||
---
|
||||
|
||||
Fallback to `{path}.html` when `{path}` is not found in the Tauri custom protocol handler.
|
||||
@@ -751,6 +751,18 @@ impl<R: Runtime> WindowManager<R> {
|
||||
let asset_response = assets
|
||||
.get(&path.as_str().into())
|
||||
.or_else(|| {
|
||||
eprintln!("Asset `{}` not found; fallback to {}.html", path, path);
|
||||
let fallback = format!("{}.html", path.as_str()).into();
|
||||
let asset = assets.get(&fallback);
|
||||
asset_path = fallback;
|
||||
asset
|
||||
})
|
||||
.or_else(|| {
|
||||
#[cfg(debug_assertions)]
|
||||
eprintln!(
|
||||
"Asset `{}` not found; fallback to {}/index.html",
|
||||
path, path
|
||||
);
|
||||
let fallback = format!("{}/index.html", path.as_str()).into();
|
||||
let asset = assets.get(&fallback);
|
||||
asset_path = fallback;
|
||||
@@ -758,7 +770,7 @@ impl<R: Runtime> WindowManager<R> {
|
||||
})
|
||||
.or_else(|| {
|
||||
#[cfg(debug_assertions)]
|
||||
eprintln!("Asset `{}` not found; fallback to index.html", path); // TODO log::error!
|
||||
eprintln!("Asset `{}` not found; fallback to index.html", path);
|
||||
let fallback = AssetKey::from("index.html");
|
||||
let asset = assets.get(&fallback);
|
||||
asset_path = fallback;
|
||||
|
||||
Reference in New Issue
Block a user