feat: empty search ?q=
list all paths (#311)
This commit is contained in:
parent
0cec573579
commit
5c850256f4
2 changed files with 6 additions and 4 deletions
|
@ -497,7 +497,11 @@ impl Server {
|
||||||
.get("q")
|
.get("q")
|
||||||
.ok_or_else(|| anyhow!("invalid q"))?
|
.ok_or_else(|| anyhow!("invalid q"))?
|
||||||
.to_lowercase();
|
.to_lowercase();
|
||||||
if !search.is_empty() {
|
if search.is_empty() {
|
||||||
|
return self
|
||||||
|
.handle_ls_dir(path, true, query_params, head_only, user, access_paths, res)
|
||||||
|
.await;
|
||||||
|
} else {
|
||||||
let path_buf = path.to_path_buf();
|
let path_buf = path.to_path_buf();
|
||||||
let hidden = Arc::new(self.args.hidden.to_vec());
|
let hidden = Arc::new(self.args.hidden.to_vec());
|
||||||
let hidden = hidden.clone();
|
let hidden = hidden.clone();
|
||||||
|
|
|
@ -147,9 +147,7 @@ fn head_dir_search(#[with(&["-A"])] server: TestServer) -> Result<(), Error> {
|
||||||
#[rstest]
|
#[rstest]
|
||||||
fn empty_search(#[with(&["-A"])] server: TestServer) -> Result<(), Error> {
|
fn empty_search(#[with(&["-A"])] server: TestServer) -> Result<(), Error> {
|
||||||
let resp = reqwest::blocking::get(format!("{}?q=", server.url()))?;
|
let resp = reqwest::blocking::get(format!("{}?q=", server.url()))?;
|
||||||
assert_eq!(resp.status(), 200);
|
assert_resp_paths!(resp);
|
||||||
let paths = utils::retrieve_index_paths(&resp.text()?);
|
|
||||||
assert!(paths.is_empty());
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue