diff options
Diffstat (limited to 'src/listing.rs')
-rw-r--r-- | src/listing.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/listing.rs b/src/listing.rs index 5fde879..4a0927b 100644 --- a/src/listing.rs +++ b/src/listing.rs @@ -132,12 +132,17 @@ pub fn directory_listing<S>( skip_symlinks: bool, file_upload: bool, random_route: Option<String>, + upload_route: String, ) -> Result<HttpResponse, io::Error> { let title = format!("Index of {}", req.path()); let base = Path::new(req.path()); let random_route = format!("/{}", random_route.unwrap_or_default()); let is_root = base.parent().is_none() || req.path() == random_route; let page_parent = base.parent().map(|p| p.display().to_string()); + let current_dir = match base.strip_prefix(random_route) { + Ok(c_d) => Path::new("/").join(c_d), + Err(_) => base.to_path_buf(), + }; let (sort_method, sort_order, download) = if let Ok(query) = Query::<QueryParameters>::extract(req) { @@ -267,7 +272,8 @@ pub fn directory_listing<S>( sort_method, sort_order, file_upload, - &base.to_string_lossy(), + &upload_route, + ¤t_dir.display().to_string(), ) .into_string(), )) |