aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/listing.rs17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/listing.rs b/src/listing.rs
index a8668e3..c837576 100644
--- a/src/listing.rs
+++ b/src/listing.rs
@@ -161,6 +161,14 @@ pub fn directory_listing(
let current_user: Option<&CurrentUser> = extensions.get::<CurrentUser>();
let conf = req.app_data::<crate::MiniserveConfig>().unwrap();
+ if conf.disable_indexing {
+ return Ok(ServiceResponse::new(
+ req.clone(),
+ HttpResponse::NotFound()
+ .content_type(mime::TEXT_PLAIN_UTF_8)
+ .body("File not found."),
+ ));
+ }
let serve_path = req.path();
let base = Path::new(serve_path);
@@ -376,15 +384,6 @@ pub fn directory_listing(
.body(actix_web::body::BodyStream::new(rx)),
))
} else {
- if conf.disable_indexing {
- return Ok(ServiceResponse::new(
- req.clone(),
- HttpResponse::NotFound()
- .content_type(mime::TEXT_PLAIN_UTF_8)
- .body("File not found."),
- ));
- }
-
Ok(ServiceResponse::new(
req.clone(),
HttpResponse::Ok().content_type(mime::TEXT_HTML_UTF_8).body(