From: Andrew Gerrand
+Templates using the undocumented and only partially implemented +"noescape" feature will break: that feature was removed. +
+diff --git a/src/pkg/html/template/escape.go b/src/pkg/html/template/escape.go index ce11dedf6b..4829bfcc43 100644 --- a/src/pkg/html/template/escape.go +++ b/src/pkg/html/template/escape.go @@ -220,10 +220,7 @@ func ensurePipelineContains(p *parse.PipeNode, s []string) { idents := p.Cmds for i := n - 1; i >= 0; i-- { if cmd := p.Cmds[i]; len(cmd.Args) != 0 { - if id, ok := cmd.Args[0].(*parse.IdentifierNode); ok { - if id.Ident == "noescape" { - return - } + if _, ok := cmd.Args[0].(*parse.IdentifierNode); ok { continue } } diff --git a/src/pkg/html/template/escape_test.go b/src/pkg/html/template/escape_test.go index 0d08101ecf..de3659ba8f 100644 --- a/src/pkg/html/template/escape_test.go +++ b/src/pkg/html/template/escape_test.go @@ -550,11 +550,6 @@ func TestEscape(t *testing.T) { "", "", }, - { - "auditable exemption from escaping", - "{{range .A}}{{. | noescape}}{{end}}", - "", - }, { "No tag injection", `{{"10$"}}<{{"script src,evil.org/pwnd.js"}}...`, @@ -659,12 +654,6 @@ func TestEscape(t *testing.T) { for _, test := range tests { tmpl := New(test.name) - // TODO: Move noescape into template/func.go - tmpl.Funcs(FuncMap{ - "noescape": func(a ...interface{}) string { - return fmt.Sprint(a...) - }, - }) tmpl = Must(tmpl.Parse(test.input)) b := new(bytes.Buffer) if err := tmpl.Execute(b, data); err != nil {