Improve handling of <nil> Params

Fixes #8825
This commit is contained in:
Bjørn Erik Pedersen
2021-07-30 10:56:45 +02:00
parent 268065cb2d
commit e3dc5240f0
6 changed files with 74 additions and 11 deletions

View File

@@ -1400,17 +1400,25 @@ func (s *Site) getMenusFromConfig() navigation.Menus {
s.Log.Errorf("unable to process menus in site config\n")
s.Log.Errorln(err)
} else {
handleErr := func(err error) {
if err == nil {
return
}
s.Log.Errorf("unable to process menus in site config\n")
s.Log.Errorln(err)
}
for _, entry := range m {
s.Log.Debugf("found menu: %q, in site config\n", name)
menuEntry := navigation.MenuEntry{Menu: name}
ime, err := maps.ToStringMapE(entry)
if err != nil {
s.Log.Errorf("unable to process menus in site config\n")
s.Log.Errorln(err)
}
handleErr(err)
err = menuEntry.MarshallMap(ime)
handleErr(err)
menuEntry.MarshallMap(ime)
// TODO(bep) clean up all of this
menuEntry.ConfiguredURL = s.Info.createNodeMenuEntryURL(menuEntry.ConfiguredURL)