You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a page URL is joined with the base URL, too many slashes are added, causing some dev servers (in my case, the Nuxt dev server) to return a 404 instead of showing the page.
With config..
"devPath": "http://localhost:3000",
..WindowManager.get_url() returns http://localhost:3000/with a trailing slash, even though in the config file it doesn't have a trailing slash.
..results in the webview trying to load http://localhost:3000//login because the format call adds an additional slash inbetween the base url and the path. This is a problem if the dev server doesn't normalise the path and just tries to match //login - resulting in a 404 instead of the expected page.
If I replace that format line in manager.rs in the Tauri project with the following, to prevent adding a slash inbetween the parts if the base url already has a trailing slash..
let separator = match url.ends_with("/"){true => "",false => "/",};format!("{}{}{}", url, separator, path.to_string_lossy())
..then I get http://localhost:3000/login and everything works as expected.
I don't know what platform and compatibility considerations the URLs in Tauri have, so I don't know if this fix would be applicable for all users and build targets. But if the above fix is acceptable I'll gladly create a pull request.
Describe the bug
When a page URL is joined with the base URL, too many slashes are added, causing some dev servers (in my case, the Nuxt dev server) to return a 404 instead of showing the page.
With config..
..
WindowManager.get_url()
returnshttp://localhost:3000/
with a trailing slash, even though in the config file it doesn't have a trailing slash.However,
WindowManager.prepare_window()
combines the base url with the path like this....which means that this code..
..results in the webview trying to load
http://localhost:3000//login
because the format call adds an additional slash inbetween the base url and the path. This is a problem if the dev server doesn't normalise the path and just tries to match//login
- resulting in a 404 instead of the expected page.If I replace that format line in
manager.rs
in the Tauri project with the following, to prevent adding a slash inbetween the parts if the base url already has a trailing slash....then I get
http://localhost:3000/login
and everything works as expected.I don't know what platform and compatibility considerations the URLs in Tauri have, so I don't know if this fix would be applicable for all users and build targets. But if the above fix is acceptable I'll gladly create a pull request.
Platform and Versions (required):
The text was updated successfully, but these errors were encountered: