diff options
author | Bjørn Erik Pedersen <[email protected]> | 2024-01-31 09:43:02 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2024-01-31 09:43:02 +0100 |
commit | 309d61b22064e59f17d3d8cc44b02d9007e24dcb (patch) | |
tree | 2500bf637ab4c71833ab99503a7a3725f385ab52 /output | |
parent | 5b7cb258ec26d7de690099f5dc39935b8d728155 (diff) | |
download | hugo-309d61b22064e59f17d3d8cc44b02d9007e24dcb.tar.gz hugo-309d61b22064e59f17d3d8cc44b02d9007e24dcb.zip |
output: Prevent setting Name directly in new output formats
Name is derived from the map key.
Closes #11947
Diffstat (limited to 'output')
-rw-r--r-- | output/config.go | 2 | ||||
-rw-r--r-- | output/outputFormat.go | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/output/config.go b/output/config.go index a7ebf5107..09d29f184 100644 --- a/output/config.go +++ b/output/config.go @@ -65,10 +65,10 @@ func DecodeConfig(mediaTypes media.Types, in any) (*config.ConfigNamespace[map[s } newOutFormat := defaultOutputFormat - newOutFormat.Name = k if err := decode(mediaTypes, v, &newOutFormat); err != nil { return f, nil, err } + newOutFormat.Name = k f = append(f, newOutFormat) diff --git a/output/outputFormat.go b/output/outputFormat.go index 54e7fe98d..981d895b6 100644 --- a/output/outputFormat.go +++ b/output/outputFormat.go @@ -29,7 +29,7 @@ type Format struct { // The Name is used as an identifier. Internal output formats (i.e. html and rss) // can be overridden by providing a new definition for those types. // <docsmeta>{ "identifiers": ["html", "rss"] }</docsmeta> - Name string `json:"name"` + Name string `json:"-"` MediaType media.Type `json:"-"` |