diff options
author | boastful-squirrel <boastful.squirrel@gmail.com> | 2019-11-22 00:53:34 +0000 |
---|---|---|
committer | boastful-squirrel <boastful.squirrel@gmail.com> | 2019-11-22 00:53:34 +0000 |
commit | f258b7061a3dad6f2daf09ae928763232a933832 (patch) | |
tree | 43e245bb09267d1b058364fbf3d854af1978b898 /src/listing.rs | |
parent | Merge pull request #217 from svenstaro/dependabot/cargo/port_check-0.1.2 (diff) | |
download | miniserve-f258b7061a3dad6f2daf09ae928763232a933832.tar.gz miniserve-f258b7061a3dad6f2daf09ae928763232a933832.zip |
Compare paths instead of strings
Diffstat (limited to 'src/listing.rs')
-rw-r--r-- | src/listing.rs | 2 |
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(), |