From 058f230a1be1abaf589b5a194ef6ec12d14c4021 Mon Sep 17 00:00:00 2001 From: Bjørn Erik Pedersen Date: Sat, 3 Feb 2024 13:09:53 +0100 Subject: Detect now invalid path patterns in cascade Closes #11977 --- config/allconfig/allconfig.go | 2 +- config/allconfig/alldecoders.go | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) (limited to 'config') diff --git a/config/allconfig/allconfig.go b/config/allconfig/allconfig.go index 413baebd1..7052f0abd 100644 --- a/config/allconfig/allconfig.go +++ b/config/allconfig/allconfig.go @@ -965,7 +965,7 @@ func decodeConfigFromParams(fs afero.Fs, logger loggers.Logger, bcfg config.Base }) for _, v := range decoderSetups { - p := decodeConfig{p: p, c: target, fs: fs, bcfg: bcfg} + p := decodeConfig{p: p, c: target, fs: fs, logger: logger, bcfg: bcfg} if err := v.decode(v, p); err != nil { return fmt.Errorf("failed to decode %q: %w", v.key, err) } diff --git a/config/allconfig/alldecoders.go b/config/allconfig/alldecoders.go index f96c19cfc..5ab76dec5 100644 --- a/config/allconfig/alldecoders.go +++ b/config/allconfig/alldecoders.go @@ -18,6 +18,7 @@ import ( "strings" "github.com/gohugoio/hugo/cache/filecache" + "github.com/gohugoio/hugo/common/loggers" "github.com/gohugoio/hugo/common/maps" "github.com/gohugoio/hugo/common/types" "github.com/gohugoio/hugo/config" @@ -42,10 +43,11 @@ import ( ) type decodeConfig struct { - p config.Provider - c *Config - fs afero.Fs - bcfg config.BaseConfig + p config.Provider + c *Config + fs afero.Fs + logger loggers.Logger + bcfg config.BaseConfig } type decodeWeight struct { @@ -291,7 +293,7 @@ var allDecoderSetups = map[string]decodeWeight{ key: "cascade", decode: func(d decodeWeight, p decodeConfig) error { var err error - p.c.Cascade, err = page.DecodeCascadeConfig(p.p.Get(d.key)) + p.c.Cascade, err = page.DecodeCascadeConfig(p.logger, p.p.Get(d.key)) return err }, }, -- cgit v1.2.3