Skip to content

Commit

Permalink
fileserver: Don't replace in request paths (fix #4027)
Browse files Browse the repository at this point in the history
  • Loading branch information
mholt committed Mar 1, 2021
1 parent ec309c6 commit 5bf0a55
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions modules/caddyhttp/fileserver/staticfiles.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,11 @@ func (fsrv *FileServer) ServeHTTP(w http.ResponseWriter, r *http.Request, next c
filesToHide := fsrv.transformHidePaths(repl)

root := repl.ReplaceAll(fsrv.Root, ".")
suffix := repl.ReplaceAll(r.URL.Path, "")
filename := sanitizedPathJoin(root, suffix)
filename := sanitizedPathJoin(root, r.URL.Path)

fsrv.logger.Debug("sanitized path join",
zap.String("site_root", root),
zap.String("request_path", suffix),
zap.String("request_path", r.URL.Path),
zap.String("result", filename))

// get information about the file
Expand Down

0 comments on commit 5bf0a55

Please sign in to comment.