From 02a75cc239c58d2b5af4fec89c48afa147e2e50d Mon Sep 17 00:00:00 2001 From: "Eon S. Jeon" Date: Sat, 29 Dec 2018 22:40:17 +0900 Subject: [PATCH] show index if index file doesn't exist --- src/fs.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/fs.rs b/src/fs.rs index 6e5b2d788..e36731d95 100644 --- a/src/fs.rs +++ b/src/fs.rs @@ -749,6 +749,11 @@ impl StaticFiles { if path.is_dir() { if let Some(redir_index) = C::index_file() { path.push(redir_index); + if !path.exists() { + path.pop(); + let dir = Directory::new(self.directory.clone(), path); + return Ok(C::directory_listing(&dir, &req)?.into()) + } } else if C::show_index() { let dir = Directory::new(self.directory.clone(), path); return Ok(C::directory_listing(&dir, &req)?.into())