mirror of
https://github.com/caddyserver/caddy.git
synced 2024-11-22 13:29:01 +08:00
fileserver: Remove trailing slash on fs filenames (#5417)
This commit is contained in:
parent
99d47050e9
commit
94d41a9d86
|
@ -250,7 +250,8 @@ func (fsrv *FileServer) ServeHTTP(w http.ResponseWriter, r *http.Request, next c
|
|||
|
||||
root := repl.ReplaceAll(fsrv.Root, ".")
|
||||
|
||||
filename := caddyhttp.SanitizedPathJoin(root, r.URL.Path)
|
||||
// remove any trailing `/` as it breaks fs.ValidPath() in the stdlib
|
||||
filename := strings.TrimSuffix(caddyhttp.SanitizedPathJoin(root, r.URL.Path), "/")
|
||||
|
||||
fsrv.logger.Debug("sanitized path join",
|
||||
zap.String("site_root", root),
|
||||
|
|
Loading…
Reference in New Issue
Block a user