diff options
author | HayatoShiba <55432631+HayatoShiba@users.noreply.github.com> | 2021-09-18 20:51:59 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-18 05:51:59 -0600 |
commit | d3a025994466c3d055fc3fc62bbb048c76f3e1c2 (patch) | |
tree | cb2c9951cd72e9a9f23c0c419724f8ad8c55421f /modules/caddyhttp/fileserver/browse.go | |
parent | 5fda9610f907482497a7b32abb2ab2f85a4e6906 (diff) |
fileserver: Fix displayed file size if it is symlink (#4354)
* Fix file size if it is symlink
* change the variable name for readability
Diffstat (limited to 'modules/caddyhttp/fileserver/browse.go')
-rw-r--r-- | modules/caddyhttp/fileserver/browse.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/modules/caddyhttp/fileserver/browse.go b/modules/caddyhttp/fileserver/browse.go index cd9bcbc..92a1e6e 100644 --- a/modules/caddyhttp/fileserver/browse.go +++ b/modules/caddyhttp/fileserver/browse.go @@ -137,7 +137,12 @@ func (fsrv *FileServer) loadDirectoryContents(dir *os.File, root, urlPath string // user can presumably browse "up" to parent folder if path is longer than "/" canGoUp := len(urlPath) > 1 - return fsrv.directoryListing(files, canGoUp, root, urlPath, repl), nil + l, err := fsrv.directoryListing(files, canGoUp, root, urlPath, repl) + if err != nil { + return browseTemplateContext{}, err + } + + return l, nil } // browseApplyQueryParams applies query parameters to the listing. |