mirror of
https://github.com/tauri-apps/tauri.git
synced 2024-12-23 18:53:33 +03:00
fix(cli): Ignore query parameter in dev server (#8697)
* fix(cli): Ignore query parameter in dev server fixes #8148 additional ref: https://discord.com/channels/616186924390023171/1201199918379974766 * Update .changes/cli-devserver-queryparam.md --------- Co-authored-by: Amr Bashir <amr.bashir2015@gmail.com>
This commit is contained in:
parent
a9b2c0625c
commit
0bff8c325d
6
.changes/cli-devserver-queryparam.md
Normal file
6
.changes/cli-devserver-queryparam.md
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
"tauri-cli": patch:bug
|
||||
"@tauri-apps/cli": patch:bug
|
||||
---
|
||||
|
||||
Fix the built-in dev server failing to serve files when URL had queries `?` and other url components.
|
@ -123,11 +123,13 @@ pub fn start_dev_server<P: AsRef<Path>>(path: P, port: Option<u16>) -> crate::Re
|
||||
}
|
||||
|
||||
async fn handler(uri: axum::http::Uri, state: Arc<State>) -> impl IntoResponse {
|
||||
let uri = uri.to_string();
|
||||
// Frontend files should not contain query parameters. This seems to be how vite handles it.
|
||||
let uri = uri.path();
|
||||
|
||||
let uri = if uri == "/" {
|
||||
&uri
|
||||
uri
|
||||
} else {
|
||||
uri.strip_prefix('/').unwrap_or(&uri)
|
||||
uri.strip_prefix('/').unwrap_or(uri)
|
||||
};
|
||||
|
||||
let file = std::fs::read(state.serve_dir.join(uri))
|
||||
|
Loading…
Reference in New Issue
Block a user