From f258b7061a3dad6f2daf09ae928763232a933832 Mon Sep 17 00:00:00 2001 From: boastful-squirrel Date: Fri, 22 Nov 2019 01:53:34 +0100 Subject: Compare paths instead of strings --- src/listing.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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( 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(), -- cgit v1.2.3