mirror of
https://github.com/caddyserver/caddy.git
synced 2024-12-26 13:43:47 +03:00
fileserver: Remove trailing slash on fs filenames (#5417)
This commit is contained in:
parent
99d47050e9
commit
94d41a9d86
1 changed files with 2 additions and 1 deletions
|
@ -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 a new issue