aboutsummaryrefslogtreecommitdiffstats
path: root/src/listing.rs
diff options
context:
space:
mode:
authorSven-Hendrik Haase <svenstaro@gmail.com>2022-02-06 12:23:21 +0000
committerGitHub <noreply@github.com>2022-02-06 12:23:21 +0000
commitbe047cb646418cb45bafc8444b00c9676a6c36bc (patch)
tree1f65ab57c3f606d612e2419faa25cf041583f010 /src/listing.rs
parentMerge pull request #727 from svenstaro/dependabot/cargo/rustls-pemfile-0.3.0 (diff)
parentFix route_prefix for css and favicon (diff)
downloadminiserve-be047cb646418cb45bafc8444b00c9676a6c36bc.tar.gz
miniserve-be047cb646418cb45bafc8444b00c9676a6c36bc.zip
Merge pull request #728 from aliemjay/custom_route_prefix
Custom route prefix
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();