fileserver: Replace \ with \\ in file matcher paths

This commit is contained in:
Matthew Holt
2026-02-19 13:17:19 -07:00
parent db256b53e5
commit a2825c5dd9
3 changed files with 7 additions and 0 deletions

View File

@@ -720,6 +720,7 @@ var globSafeRepl = strings.NewReplacer(
"*", "\\*",
"[", "\\[",
"?", "\\?",
"\\", "\\\\",
)
const (

View File

@@ -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{},