fix: decodeURI searching string (#61)
This commit is contained in:
parent
c85ea06785
commit
069cb64889
2 changed files with 14 additions and 1 deletions
|
@ -153,7 +153,8 @@ impl Server {
|
|||
} else if query == "zip" {
|
||||
self.handle_zip_dir(path, head_only, &mut res).await?;
|
||||
} else if let Some(q) = query.strip_prefix("q=") {
|
||||
self.handle_query_dir(path, q, head_only, &mut res).await?;
|
||||
let q = decode_uri(q).unwrap_or_default();
|
||||
self.handle_query_dir(path, &q, head_only, &mut res).await?;
|
||||
} else {
|
||||
self.handle_ls_dir(path, true, head_only, &mut res).await?;
|
||||
}
|
||||
|
|
|
@ -74,6 +74,18 @@ fn get_dir_search(server: TestServer) -> Result<(), Error> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
fn get_dir_search2(server: TestServer) -> Result<(), Error> {
|
||||
let resp = reqwest::blocking::get(format!("{}?q={}", server.url(), "😀.data"))?;
|
||||
assert_eq!(resp.status(), 200);
|
||||
let paths = utils::retrive_index_paths(&resp.text()?);
|
||||
assert!(!paths.is_empty());
|
||||
for p in paths {
|
||||
assert!(p.contains(&"😀.data"));
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
fn head_dir_search(server: TestServer) -> Result<(), Error> {
|
||||
let resp = fetch!(b"HEAD", format!("{}?q={}", server.url(), "test.html")).send()?;
|
||||
|
|
Loading…
Reference in a new issue