Skip to content

Commit 702e514

Browse files
authored
Merge pull request #734 from lumi-me-not/serve_dir_prefix_strip
In `serve_dir`, only strip the prefix from the start of the path once.
2 parents 7a78ebe + 4d94352 commit 702e514

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/fs/serve_dir.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ where
2525
{
2626
async fn call(&self, req: Request<State>) -> Result {
2727
let path = req.url().path();
28-
let path = path.trim_start_matches(&self.prefix);
28+
let path = path.strip_prefix(&self.prefix).unwrap();
2929
let path = path.trim_start_matches('/');
3030
let mut file_path = self.dir.clone();
3131
for p in Path::new(path) {

0 commit comments

Comments
 (0)