From 586769e8f6c3029a3b37087ea0019f85e250fab3 Mon Sep 17 00:00:00 2001 From: lezli01 Date: Sun, 25 Oct 2026 11:59:39 +0100 Subject: [PATCH] fix(navigation): let the bundled app load in release builds Tauri loads the bundled frontend at `tauri://localhost` with no trailing slash. `tauri:` is not a special URL scheme, so that URL's path is empty rather than "/", and the navigation guard blocked the app's own start page, leaving a blank white window. Dev builds were unaffected because the Vite dev server URL is http and normalizes to "/". Accept the empty path on the app origin and cover it with a test. Co-Authored-By: Claude Opus 5.5 (1M context) --- src-tauri/src/navigation.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src-tauri/src/navigation.rs b/src-tauri/src/navigation.rs index 34655b0..ab47bae 100644 --- a/src-tauri/src/navigation.rs +++ b/src-tauri/src/navigation.rs @@ -39,7 +39,8 @@ fn classify(url: &Url, dev_url: Option<&Url>) -> Destination { // markpad is a single page. Any other path on its origin is a relative // link (`other.md`) resolved against the app instead of the document, // and would show the app's fallback page or a raw file — not markpad. - return if matches!(url.path(), "/" | "/index.html") { + // `tauri://localhost` (how Tauri loads index.html) has an empty path. + return if matches!(url.path(), "" | "/" | "/index.html") { Destination::App } else { Destination::Blocked @@ -110,6 +111,9 @@ mod tests { #[test] fn app_frontend_stays_in_the_window() { + // Tauri loads `tauri://localhost` with no trailing slash, and `tauri:` is + // not a special scheme, so its path is "" rather than "/". + assert_eq!(classify(&url("tauri://localhost"), None), Destination::App); assert_eq!(classify(&url("tauri://localhost/"), None), Destination::App); assert_eq!( classify(&url("http://tauri.localhost/index.html"), None),