URL in WindowManager.prepare_window()
has double slashes
#2281
Labels
WindowManager.prepare_window()
has double slashes
#2281
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: