resources/page: Make sure a map is always initialized

Fixes #13810
This commit is contained in:
Bjørn Erik Pedersen
2025-06-19 19:52:08 +02:00
parent 18a9ca7d7a
commit 36f6f987a9
2 changed files with 6 additions and 4 deletions

View File

@@ -174,6 +174,9 @@ func DecodeCascade(logger loggers.Logger, handleLegacyFormat bool, in any) (*map
func mapToPageMatcherParamsConfig(m map[string]any) (PageMatcherParamsConfig, error) {
var pcfg PageMatcherParamsConfig
if pcfg.Fields == nil {
pcfg.Fields = make(maps.Params)
}
for k, v := range m {
switch strings.ToLower(k) {
case "_target", "target":
@@ -193,9 +196,6 @@ func mapToPageMatcherParamsConfig(m map[string]any) (PageMatcherParamsConfig, er
}
}
default:
if pcfg.Fields == nil {
pcfg.Fields = make(maps.Params)
}
pcfg.Fields[k] = v
}