mirror of https://github.com/fafhrd91/actix-web
show index if index file doesn't exist
This commit is contained in:
parent
410a02525f
commit
02a75cc239
|
@ -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())
|
||||
|
|
Loading…
Reference in New Issue