Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS
Mirrored from https://github.com/Slazee/caddy.git
Synced Nov 11, 14:45 UTC
fileserver: Replace \ with \\ in file matcher paths
Matthew Holt committed
Feb 19, 2026 at 13:17 UTC
a2825c5dd952769f139a16448dc1ca1be61b6058
3 files changed
+7
modules/caddyhttp/fileserver/matcher.go
+1
@@ -720,6 +720,7 @@ var globSafeRepl = strings.NewReplacer(
720
"*", "\\*",
721
"[", "\\[",
722
"?", "\\?",
723
+ "\\", "\\\\",
724
)
725
726
const (
modules/caddyhttp/fileserver/matcher_test.go
+6
@@ -115,6 +115,12 @@ func TestFileMatcher(t *testing.T) {
115
expectedType: "file",
116
matched: !isWindows,
117
},
118
+ {
119
+ path: "/foodir/secr%5Cet.txt",
120
+ expectedPath: "/foodir/secr\\et.txt",
121
+ expectedType: "file",
122
+ matched: true,
123
+ },
124
} {
125
m := &MatchFile{
126
fsmap: &filesystems.FileSystemMap{},