Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS
Mirrored from https://github.com/Slazee/caddy.git
Synced Nov 13, 13:00 UTC
fileserver: Ignore EOF when browsing empty dir
Thanks to @WeidiDeng for reporting this
Matthew Holt committed
Sep 7, 2022 at 21:14 UTC
c19f2072379e18fbf3b2409ecd49ca023d62b882
1 file changed
+2
-1
modules/caddyhttp/fileserver/browse.go
+2
-1
@@ -19,6 +19,7 @@ import (
19
_ "embed"
20
"encoding/json"
21
"fmt"
22
+ "io"
23
"io/fs"
24
"net/http"
25
"os"
@@ -137,7 +138,7 @@ func (fsrv *FileServer) serveBrowse(root, dirPath string, w http.ResponseWriter,
138
139
func (fsrv *FileServer) loadDirectoryContents(dir fs.ReadDirFile, root, urlPath string, repl *caddy.Replacer) (browseTemplateContext, error) {
140
files, err := dir.ReadDir(10000) // TODO: this limit should probably be configurable
140
- if err != nil {
141
+ if err != nil && err != io.EOF {
142
return browseTemplateContext{}, err
143
}
144