mirror of
https://github.com/caddyserver/caddy.git
synced 2026-03-17 14:34:03 +00:00
fileserver: Replace \ with \\ in file matcher paths
This commit is contained in:
@@ -720,6 +720,7 @@ var globSafeRepl = strings.NewReplacer(
|
||||
"*", "\\*",
|
||||
"[", "\\[",
|
||||
"?", "\\?",
|
||||
"\\", "\\\\",
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -115,6 +115,12 @@ func TestFileMatcher(t *testing.T) {
|
||||
expectedType: "file",
|
||||
matched: !isWindows,
|
||||
},
|
||||
{
|
||||
path: "/foodir/secr%5Cet.txt",
|
||||
expectedPath: "/foodir/secr\\et.txt",
|
||||
expectedType: "file",
|
||||
matched: true,
|
||||
},
|
||||
} {
|
||||
m := &MatchFile{
|
||||
fsmap: &filesystems.FileSystemMap{},
|
||||
|
||||
0
modules/caddyhttp/fileserver/testdata/foodir/secr\et.txt
vendored
Normal file
0
modules/caddyhttp/fileserver/testdata/foodir/secr\et.txt
vendored
Normal file
Reference in New Issue
Block a user