From 5bf0a55df499e189424103d87d93960395d3172f Mon Sep 17 00:00:00 2001 From: Matthew Holt Date: Mon, 1 Mar 2021 13:49:13 -0700 Subject: fileserver: Don't replace in request paths (fix #4027) --- modules/caddyhttp/fileserver/staticfiles.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'modules') diff --git a/modules/caddyhttp/fileserver/staticfiles.go b/modules/caddyhttp/fileserver/staticfiles.go index daf4b54..e809f49 100644 --- a/modules/caddyhttp/fileserver/staticfiles.go +++ b/modules/caddyhttp/fileserver/staticfiles.go @@ -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 -- cgit v1.2.3