aboutsummaryrefslogtreecommitdiffstats
path: root/src/listing.rs
diff options
context:
space:
mode:
authorAli MJ Al-Nasrawy <alimjalnasrawy@gmail.com>2022-02-06 10:12:19 +0000
committerAli MJ Al-Nasrawy <alimjalnasrawy@gmail.com>2022-02-06 10:12:19 +0000
commit8e0930cc9f25e44a69f61763ac5ff38ba58bb3dd (patch)
treee9500f4d2180984fe7981205c44ac89048f1019c /src/listing.rs
parentMerge pull request #725 from aliemjay/update_actix_web (diff)
parentApply alimjays suggestion (diff)
downloadminiserve-8e0930cc9f25e44a69f61763ac5ff38ba58bb3dd.tar.gz
miniserve-8e0930cc9f25e44a69f61763ac5ff38ba58bb3dd.zip
Merge 'jikstra/feat_route_prefix' #682
Diffstat (limited to 'src/listing.rs')
-rw-r--r--src/listing.rs8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/listing.rs b/src/listing.rs
index 9e02598..05e800c 100644
--- a/src/listing.rs
+++ b/src/listing.rs
@@ -161,7 +161,7 @@ pub fn directory_listing(
let serve_path = req.path();
let base = Path::new(serve_path);
- let random_route_abs = format!("/{}", conf.random_route.clone().unwrap_or_default());
+ let random_route_abs = format!("/{}", conf.route_prefix);
let is_root = base.parent().is_none() || Path::new(&req.path()) == Path::new(&random_route_abs);
let encoded_dir = match base.strip_prefix(random_route_abs) {
@@ -180,10 +180,8 @@ pub fn directory_listing(
let decoded = percent_decode_str(&encoded_dir).decode_utf8_lossy();
let mut res: Vec<Breadcrumb> = Vec::new();
- let mut link_accumulator = match &conf.random_route {
- Some(random_route) => format!("/{}/", random_route),
- None => "/".to_string(),
- };
+
+ let mut link_accumulator = format!("{}/", &conf.route_prefix);
let mut components = Path::new(&*decoded).components().peekable();