aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven-Hendrik Haase <svenstaro@gmail.com>2020-03-01 06:50:21 +0000
committerGitHub <noreply@github.com>2020-03-01 06:50:21 +0000
commitdbe645d1a0a581286d8b6fcf0c6e7d9c2ca0ebca (patch)
tree45c5a582ed5017c6a4acf0182d03a854dc60da70
parentMerge pull request #189 from efx/fix-156 (diff)
parentCompare paths instead of strings (diff)
downloadminiserve-dbe645d1a0a581286d8b6fcf0c6e7d9c2ca0ebca.tar.gz
miniserve-dbe645d1a0a581286d8b6fcf0c6e7d9c2ca0ebca.zip
Merge pull request #219 from ghost/path-comparison
Compare paths instead of strings
-rw-r--r--src/listing.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/listing.rs b/src/listing.rs
index 42eb59a..d419775 100644
--- a/src/listing.rs
+++ b/src/listing.rs
@@ -152,7 +152,7 @@ pub fn directory_listing<S>(
let base = Path::new(serve_path);
let random_route = format!("/{}", random_route.unwrap_or_default());
- let is_root = base.parent().is_none() || req.path() == random_route;
+ let is_root = base.parent().is_none() || Path::new(&req.path()) == Path::new(&random_route);
let current_dir = match base.strip_prefix(random_route) {
Ok(c_d) => Path::new("/").join(c_d),
Err(_) => base.to_path_buf(),