Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tpl/transform: Unmarshal whitespace removal produces invalid YAML #12977

Closed
jmooring opened this issue Oct 21, 2024 · 1 comment · Fixed by #12978
Closed

tpl/transform: Unmarshal whitespace removal produces invalid YAML #12977

jmooring opened this issue Oct 21, 2024 · 1 comment · Fixed by #12978

Comments

@jmooring
Copy link
Member

jmooring commented Oct 21, 2024

This change in v0.136.3 removes whitespace from a YAML string before we unmarshal it:

42f37b4#diff-ac3fd377a127dfceca723e62fdde1176ab715eaa2068402c3e2777a47e409414R115

I just ran into this in the wild...

{{ $yaml := `
  a:
    b: 1
    c: 2
  d:
    e: 3
    f: 4
`}}

{{ transform.Unmarshal $yaml }}

When we remove the leading whitespace, the outermost key is no longer indented, but later keys that should be at the same level are still indented 2 spaces, producing invalid HTML.

error calling Unmarshal: "_stream.yaml:3:1": failed to unmarshal YAML: yaml: line 3: did not find expected key

Reference: https://discourse.gohugo.io/t/site-compiled-fine-at-v135-0-but-fails-on-v136-3

Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant