diff options
author | Matthew Holt <mholt@users.noreply.github.com> | 2022-09-07 21:14:11 -0600 |
---|---|---|
committer | Matthew Holt <mholt@users.noreply.github.com> | 2022-09-07 21:14:11 -0600 |
commit | c19f2072379e18fbf3b2409ecd49ca023d62b882 (patch) | |
tree | bfc4b519d4114148e53018f20bac4f5185638f3b /modules/caddyhttp | |
parent | dd9813c65be3af8e222bda6e63f5eea9232c6eee (diff) |
fileserver: Ignore EOF when browsing empty dir
Thanks to @WeidiDeng for reporting this
Diffstat (limited to 'modules/caddyhttp')
-rw-r--r-- | modules/caddyhttp/fileserver/browse.go | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/modules/caddyhttp/fileserver/browse.go b/modules/caddyhttp/fileserver/browse.go index 7804d19..6a72e15 100644 --- a/modules/caddyhttp/fileserver/browse.go +++ b/modules/caddyhttp/fileserver/browse.go @@ -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 } |