diff options
author | Carson McManus <carson.mcmanus1@gmail.com> | 2024-01-30 14:45:15 +0000 |
---|---|---|
committer | Carson McManus <carson.mcmanus1@gmail.com> | 2024-01-30 14:45:15 +0000 |
commit | 20b9126f2b3747686d9198661c227e43a30cd739 (patch) | |
tree | 464927cf61c82e777e429f76e515ad9a9b716720 /src/main.rs | |
parent | completely disable the listing renderer when indexing is disabled (diff) | |
download | miniserve-20b9126f2b3747686d9198661c227e43a30cd739.tar.gz miniserve-20b9126f2b3747686d9198661c227e43a30cd739.zip |
Revert "completely disable the listing renderer when indexing is disabled"
This reverts commit 7b5b1a0e7fec2c0577eb0dc2a93e9fde48228a67.
Diffstat (limited to '')
-rw-r--r-- | src/main.rs | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/src/main.rs b/src/main.rs index 63b26da..ce21260 100644 --- a/src/main.rs +++ b/src/main.rs @@ -3,7 +3,7 @@ use std::net::{IpAddr, SocketAddr, TcpListener}; use std::thread; use std::time::Duration; -use actix_files::{Directory, NamedFile}; +use actix_files::NamedFile; use actix_web::{ dev::{fn_service, ServiceRequest, ServiceResponse}, http::header::ContentType, @@ -354,21 +354,9 @@ fn configure_app(app: &mut web::ServiceConfig, conf: &MiniserveConfig) { let base_path = conf.path.clone(); let no_symlinks = conf.no_symlinks; - if !conf.disable_indexing { - files = files - .show_files_listing() - .files_listing_renderer(listing::directory_listing); - } else { - // If indexing is disabled, we return a 404 for any directory request so we don't - // leak the directory structure. - files = files.show_files_listing().files_listing_renderer( - |_dir: &Directory, req: &HttpRequest| { - let res = HttpResponse::NotFound().body("File not found."); - Ok(ServiceResponse::new(req.clone(), res)) - }, - ); - } files + .show_files_listing() + .files_listing_renderer(listing::directory_listing) .prefer_utf8(true) .redirect_to_slash_directory() .path_filter(move |path, _| { |