fix: assert file matcher placeholder as string

This commit is contained in:
cyphercodes 2026-05-03 10:58:06 +03:00 committed by Francis Lavoie
parent f7409a12f2
commit 7cc8c7c8eb

View file

@ -307,7 +307,9 @@ func escapePathPlaceholders(path string, r *http.Request, repl *caddy.Replacer)
fileMatchRelativePlaceholder := "{http.matchers.file.relative}"
if strings.Contains(path, fileMatchRelativePlaceholder) {
if val, ok := repl.Get("http.matchers.file.relative"); ok {
path = strings.ReplaceAll(path, fileMatchRelativePlaceholder, escapePathPreservingSlashes(fmt.Sprint(val)))
if relativePath, ok := val.(string); ok {
path = strings.ReplaceAll(path, fileMatchRelativePlaceholder, escapePathPreservingSlashes(relativePath))
}
}
}