mirror of
https://github.com/caddyserver/caddy.git
synced 2024-12-16 21:56:40 -05:00
fileserver: Ignore EOF when browsing empty dir
Thanks to @WeidiDeng for reporting this
This commit is contained in:
parent
dd9813c65b
commit
c19f207237
1 changed files with 2 additions and 1 deletions
|
@ -19,6 +19,7 @@ import (
|
|||
_ "embed"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/fs"
|
||||
"net/http"
|
||||
"os"
|
||||
|
@ -137,7 +138,7 @@ func (fsrv *FileServer) serveBrowse(root, dirPath string, w http.ResponseWriter,
|
|||
|
||||
func (fsrv *FileServer) loadDirectoryContents(dir fs.ReadDirFile, root, urlPath string, repl *caddy.Replacer) (browseTemplateContext, error) {
|
||||
files, err := dir.ReadDir(10000) // TODO: this limit should probably be configurable
|
||||
if err != nil {
|
||||
if err != nil && err != io.EOF {
|
||||
return browseTemplateContext{}, err
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue