Fix "serve" subcommand for URL encoded static files (#1351)

This commit is contained in:
Chiu-Hsiang Hsu 2021-02-13 12:07:01 +00:00 committed by GitHub
parent 3cb61c3bcd
commit d734b1723c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -109,7 +109,7 @@ async fn handle_request(req: Request<Body>, mut root: PathBuf) -> Result<Respons
// Remove the trailing slash from the request path
// otherwise `PathBuf` will interpret it as an absolute path
root.push(&req.uri().path()[1..]);
root.push(&decoded[1..]);
let result = tokio::fs::read(&root).await;
let contents = match result {