diff options
Diffstat (limited to 'src/listing.rs')
-rw-r--r-- | src/listing.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/listing.rs b/src/listing.rs index 855abef..64cdaca 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); |