fix: panic on PROPFIND // (#144)
parent
604ccc6556
commit
8b4727c3a4
|
@ -897,7 +897,11 @@ impl Server {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn extract_path(&self, path: &str) -> Option<PathBuf> {
|
fn extract_path(&self, path: &str) -> Option<PathBuf> {
|
||||||
let decoded_path = decode_uri(&path[1..])?;
|
let mut slash_stripped_path = path;
|
||||||
|
while let Some(p) = slash_stripped_path.strip_prefix('/') {
|
||||||
|
slash_stripped_path = p
|
||||||
|
}
|
||||||
|
let decoded_path = decode_uri(slash_stripped_path)?;
|
||||||
let slashes_switched = if cfg!(windows) {
|
let slashes_switched = if cfg!(windows) {
|
||||||
decoded_path.replace('/', "\\")
|
decoded_path.replace('/', "\\")
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -47,6 +47,13 @@ fn propfind_404(server: TestServer) -> Result<(), Error> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[rstest]
|
||||||
|
fn propfind_double_slash(server: TestServer) -> Result<(), Error> {
|
||||||
|
let resp = fetch!(b"PROPFIND", format!("{}/", server.url())).send()?;
|
||||||
|
assert_eq!(resp.status(), 207);
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
#[rstest]
|
#[rstest]
|
||||||
fn propfind_file(server: TestServer) -> Result<(), Error> {
|
fn propfind_file(server: TestServer) -> Result<(), Error> {
|
||||||
let resp = fetch!(b"PROPFIND", format!("{}test.html", server.url())).send()?;
|
let resp = fetch!(b"PROPFIND", format!("{}test.html", server.url())).send()?;
|
||||||
|
|
Loading…
Reference in New Issue