Skip to content

Commit

Permalink
fix: fix index file of dir
Browse files Browse the repository at this point in the history
  • Loading branch information
vicanso committed Oct 31, 2023
1 parent e2eb127 commit 9abdd25
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion middleware/static_serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,10 +221,11 @@ func NewStaticServe(staticFile StaticFile, config StaticServeConfig) elton.Handl
if config.DenyQueryString && url.RawQuery != "" {
return ErrStaticServeNotAllowQueryString
}
// 如果有配置目录的index文件
if config.IndexFile != "" {
fileInfo := staticFile.Stat(file)
if fileInfo != nil && fileInfo.IsDir() {
file = filepath.Join(config.Path, config.IndexFile)
file = filepath.Join(file, config.IndexFile)
}
}

Expand Down

0 comments on commit 9abdd25

Please sign in to comment.