doc/godebug.md | 5 +++++ src/html/template/attr_string.go | 5 +++-- src/html/template/context.go | 8 ++++++++ src/html/template/element_string.go | 5 +++-- src/html/template/escape.go | 14 ++++++++++++++ src/html/template/escape_test.go | 34 ++++++++++++++++++++++++++++++++++ src/html/template/state_string.go | 8 +++++--- src/html/template/transition.go | 47 +++++++++++++++++++++++++++++++++++++++++------ src/internal/godebugs/table.go | 1 + src/runtime/metrics/doc.go | 5 +++++ diff --git a/doc/godebug.md b/doc/godebug.md index a6e64d16efe45de4e5d11e66486a425ada3d378b..473057e18d12dd5b1f6c05b13df17140fabf5f4d 100644 --- a/doc/godebug.md +++ b/doc/godebug.md @@ -172,6 +172,11 @@ this setting and default was backported to Go 1.25.4 and Go 1.24.10. ### Go 1.25 +Go 1.25.8 added a new `htmlmetacontenturlescape` setting that controls whether +html/template will escape URLs in the `url=` portion of the content attribute of +HTML meta tags. The default `htmlmetacontentescape=1` will cause URLs to be +escaped. Setting `htmlmetacontentescape=0` disables this behavior. + Go 1.25 added a new `decoratemappings` setting that controls whether the Go runtime annotates OS anonymous memory mappings with context about their purpose. These annotations appear in /proc/self/maps and /proc/self/smaps as diff --git a/src/html/template/attr_string.go b/src/html/template/attr_string.go index 51c3f262084c04592e18c6c563070c706eac9ba2..7159fa9cbaa15a0b78c6c98324ad0133d180b05b 100644 --- a/src/html/template/attr_string.go +++ b/src/html/template/attr_string.go @@ -14,11 +14,12 @@ _ = x[attrScriptType-2] _ = x[attrStyle-3] _ = x[attrURL-4] _ = x[attrSrcset-5] + _ = x[attrMetaContent-6] } -const _attr_name = "attrNoneattrScriptattrScriptTypeattrStyleattrURLattrSrcset" +const _attr_name = "attrNoneattrScriptattrScriptTypeattrStyleattrURLattrSrcsetattrMetaContent" -var _attr_index = [...]uint8{0, 8, 18, 32, 41, 48, 58} +var _attr_index = [...]uint8{0, 8, 18, 32, 41, 48, 58, 73} func (i attr) String() string { if i >= attr(len(_attr_index)-1) { diff --git a/src/html/template/context.go b/src/html/template/context.go index b78f0f7325ed66545278250aabd421bd82e78920..8b3af2feabd8aa9199c1599cfff19dc455d4f431 100644 --- a/src/html/template/context.go +++ b/src/html/template/context.go @@ -156,6 +156,10 @@ stateCSSLineCmt // stateError is an infectious error state outside any valid // HTML/CSS/JS construct. stateError + // stateMetaContent occurs inside a HTML meta element content attribute. + stateMetaContent + // stateMetaContentURL occurs inside a "url=" tag in a HTML meta element content attribute. + stateMetaContentURL // stateDead marks unreachable code after a {{break}} or {{continue}}. stateDead ) @@ -267,6 +271,8 @@ // elementTextarea corresponds to the RCDATA