fix: search should ignore entry path (#235)
This commit is contained in:
parent
609017b2f5
commit
a53411b4d6
2 changed files with 11 additions and 0 deletions
|
@ -493,6 +493,7 @@ impl Server {
|
||||||
let mut paths: Vec<PathBuf> = vec![];
|
let mut paths: Vec<PathBuf> = vec![];
|
||||||
for dir in access_paths.leaf_paths(&path_buf) {
|
for dir in access_paths.leaf_paths(&path_buf) {
|
||||||
let mut it = WalkDir::new(&dir).into_iter();
|
let mut it = WalkDir::new(&dir).into_iter();
|
||||||
|
it.next();
|
||||||
while let Some(Ok(entry)) = it.next() {
|
while let Some(Ok(entry)) = it.next() {
|
||||||
if !running.load(Ordering::SeqCst) {
|
if !running.load(Ordering::SeqCst) {
|
||||||
break;
|
break;
|
||||||
|
@ -1333,6 +1334,7 @@ async fn zip_dir<W: AsyncWrite + Unpin>(
|
||||||
let mut paths: Vec<PathBuf> = vec![];
|
let mut paths: Vec<PathBuf> = vec![];
|
||||||
for dir in access_paths.leaf_paths(&dir_clone) {
|
for dir in access_paths.leaf_paths(&dir_clone) {
|
||||||
let mut it = WalkDir::new(&dir).into_iter();
|
let mut it = WalkDir::new(&dir).into_iter();
|
||||||
|
it.next();
|
||||||
while let Some(Ok(entry)) = it.next() {
|
while let Some(Ok(entry)) = it.next() {
|
||||||
if !running.load(Ordering::SeqCst) {
|
if !running.load(Ordering::SeqCst) {
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -123,6 +123,15 @@ fn get_dir_search3(#[with(&["-A"])] server: TestServer) -> Result<(), Error> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[rstest]
|
||||||
|
fn get_dir_search4(#[with(&["-A"])] server: TestServer) -> Result<(), Error> {
|
||||||
|
let resp = reqwest::blocking::get(format!("{}dir1?q=dir1&simple", server.url()))?;
|
||||||
|
assert_eq!(resp.status(), 200);
|
||||||
|
let text = resp.text().unwrap();
|
||||||
|
assert!(text.is_empty());
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
#[rstest]
|
#[rstest]
|
||||||
fn head_dir_search(#[with(&["-A"])] server: TestServer) -> Result<(), Error> {
|
fn head_dir_search(#[with(&["-A"])] server: TestServer) -> Result<(), Error> {
|
||||||
let resp = fetch!(b"HEAD", format!("{}?q={}", server.url(), "test.html")).send()?;
|
let resp = fetch!(b"HEAD", format!("{}?q={}", server.url(), "test.html")).send()?;
|
||||||
|
|
Loading…
Reference in a new issue