Bug Fix: file system traversal bug where %2F is treated as /

This commit is contained in:
int 80h
2022-02-02 18:03:04 -05:00
parent 2eabc3e893
commit 406fea7b6c
4 changed files with 8 additions and 4 deletions

View File

@@ -243,7 +243,7 @@ pub async fn handle_connection(mut con: conn::Connection, url: url::Url) -> Resu
} else {
path.push(&con.srv.server.dir);
if url.path() != "" || url.path() != "/" {
let decoded = util::url_decode(url.path().trim_start_matches('/').as_bytes());
let decoded = util::url_decode(url.path().as_bytes()).trim_start_matches('/').to_owned();
path.push(decoded);
}
}