Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS
Mirrored from https://github.com/Slazee/caddy.git
Synced Nov 14, 05:15 UTC
fileserver: Don't replace in request paths (fix #4027)
Matthew Holt committed
Mar 1, 2021 at 13:49 UTC
5bf0a55df499e189424103d87d93960395d3172f
1 file changed
+2
-3
modules/caddyhttp/fileserver/staticfiles.go
+2
-3
@@ -138,12 +138,11 @@ func (fsrv *FileServer) ServeHTTP(w http.ResponseWriter, r *http.Request, next c
138
filesToHide := fsrv.transformHidePaths(repl)
139
140
root := repl.ReplaceAll(fsrv.Root, ".")
141
- suffix := repl.ReplaceAll(r.URL.Path, "")
142
- filename := sanitizedPathJoin(root, suffix)
141
+ filename := sanitizedPathJoin(root, r.URL.Path)
142
143
fsrv.logger.Debug("sanitized path join",
144
zap.String("site_root", root),
146
- zap.String("request_path", suffix),
145
+ zap.String("request_path", r.URL.Path),
146
zap.String("result", filename))
147
148
// get information about the file