show index if index file doesn't exist

This commit is contained in:
Eon S. Jeon 2018-12-29 22:40:17 +09:00
parent 410a02525f
commit 02a75cc239
1 changed files with 5 additions and 0 deletions

View File

@ -749,6 +749,11 @@ impl<C: StaticFileConfig> StaticFiles<C> {
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())