Skip to content

Commit

Permalink
config/allconfig: Throw error when output format is not defined
Browse files Browse the repository at this point in the history
Fixes #13199
  • Loading branch information
jmooring authored and bep committed Dec 29, 2024
1 parent 77824d7 commit eb1dbe0
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion config/allconfig/allconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,7 @@ func (c *Configs) Validate(logger loggers.Logger) error {

// transientErr returns the last transient error found during config compilation.
func (c *Configs) transientErr() error {
for _, l := range c.LanguageConfigSlice {
for _, l := range c.LanguageConfigMap {
if l.C.transientErr != nil {
return l.C.transientErr
}
Expand Down
18 changes: 18 additions & 0 deletions config/allconfig/allconfig_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,3 +175,21 @@ func TestMapUglyURLs(t *testing.T) {
b.Assert(c.C.IsUglyURLSection("posts"), qt.IsTrue)
b.Assert(c.C.IsUglyURLSection("blog"), qt.IsFalse)
}

// Issue 13199
func TestInvalidOutputFormat(t *testing.T) {
t.Parallel()

files := `
-- hugo.toml --
disableKinds = ['page','rss','section','sitemap','taxonomy','term']
[outputs]
home = ['html','foo']
-- layouts/index.html --
x
`

b, err := hugolib.TestE(t, files)
b.Assert(err, qt.IsNotNil)
b.Assert(err.Error(), qt.Contains, `failed to create config: unknown output format "foo" for kind "home"`)
}

0 comments on commit eb1dbe0

Please sign in to comment.