Skip to content

Commit eb1dbe0

Browse files
jmooringbep
authored andcommitted
config/allconfig: Throw error when output format is not defined
Fixes #13199
1 parent 77824d7 commit eb1dbe0

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

config/allconfig/allconfig.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -734,7 +734,7 @@ func (c *Configs) Validate(logger loggers.Logger) error {
734734

735735
// transientErr returns the last transient error found during config compilation.
736736
func (c *Configs) transientErr() error {
737-
for _, l := range c.LanguageConfigSlice {
737+
for _, l := range c.LanguageConfigMap {
738738
if l.C.transientErr != nil {
739739
return l.C.transientErr
740740
}

config/allconfig/allconfig_integration_test.go

+18
Original file line numberDiff line numberDiff line change
@@ -175,3 +175,21 @@ func TestMapUglyURLs(t *testing.T) {
175175
b.Assert(c.C.IsUglyURLSection("posts"), qt.IsTrue)
176176
b.Assert(c.C.IsUglyURLSection("blog"), qt.IsFalse)
177177
}
178+
179+
// Issue 13199
180+
func TestInvalidOutputFormat(t *testing.T) {
181+
t.Parallel()
182+
183+
files := `
184+
-- hugo.toml --
185+
disableKinds = ['page','rss','section','sitemap','taxonomy','term']
186+
[outputs]
187+
home = ['html','foo']
188+
-- layouts/index.html --
189+
x
190+
`
191+
192+
b, err := hugolib.TestE(t, files)
193+
b.Assert(err, qt.IsNotNil)
194+
b.Assert(err.Error(), qt.Contains, `failed to create config: unknown output format "foo" for kind "home"`)
195+
}

0 commit comments

Comments
 (0)