Skip to content

html/template: template.HTML strings escaped (Go 1.9 regression) #21844

@bep

Description

@bep

This has been reported by several users in the wild after we released Hugo 0.27 built on Go 1.9.

I have tried to make a simple standalone and failing test case, not yet successful.

I have, however, a failing test inside Hugo:
https://travis-ci.org/gohugoio/hugo/builds/274496313?utm_source=github_status&utm_medium=notification

It passes fine on Go 1.8.3, fails on Go 1.9 and tip.

See gohugoio/hugo#3878

The gist of it seems to be:

  • HTML strings put into the template context, i.e. data fetched from external resources such as Twitter (Tweets) and Instagram.
  • These are wrapped as template.HTML types to mark them as safe.

Note that we have had plenty of similar and passing tests in Hugo, so there is a corner case here that I don't fully understand.

I will go back to using Go 1.8.3 (where I can).

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsDecisionFeedback is required from experts, contributors, and/or the community before a change can be made.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions