1
0
Fork 0
hugo/parser/metadecoders
Ville Vesilehto f34cdc382a
parser/metadecoder: Improve errors for non-map XML root values
Previously, the XML decoder would panic when encountering a root element with
a non-map value due to an unsafe type assertion.

The fix adds proper type checking before the map conversion and provides
clear error messages to help users identify and fix invalid XML structures.

Example error for invalid XML like:
<root>just text</root>

Will now return:
"XML root element 'root' must be a map/object, got string"
2025-03-22 18:48:23 +01:00
..
decoder.go parser/metadecoder: Improve errors for non-map XML root values 2025-03-22 18:48:23 +01:00
decoder_test.go parser/metadecoder: Improve errors for non-map XML root values 2025-03-22 18:48:23 +01:00
format.go Create a struct with all of Hugo's config options 2023-05-16 18:01:29 +02:00
format_test.go Create a struct with all of Hugo's config options 2023-05-16 18:01:29 +02:00