-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Closed
Labels
FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.
Milestone
Description
tl;dr: https://play.golang.org/p/8A4TQ1-Kvt
The html/template
defaults to the contentTypeURL
content type for any attribute that contains the substring "src"
.
However the srcset
attribute is a set of URLs which are separated by whitespace and optional extra size/density indicators (see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#attr-srcset).
For example "image1.jpg w200, image2.jpg w400"
.
When this is escaped as the contentTypeURL
the spaces are encoded, the whole thing looks like a single URL, and the resource fails to load.
tmpl := template.Must(template.New("foo").Parse(`<img srcset="{{.}}">`))
tmpl.Execute(os.Stdout, "1.jpg w200, 2.jpg w200")
Got <img srcset="1.jpg%20w200,%202.jpg%20w200">
Want <img srcset="1.jpg w200, 2.jpg w200">
tmthrgd and stapelberg
Metadata
Metadata
Assignees
Labels
FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.