From 5a3eea3dd22b0a194591ce2294b88cb340df1e8d Mon Sep 17 00:00:00 2001 From: Evan Klitzke Date: Mon, 25 Jun 2018 13:17:44 -0700 Subject: [PATCH] text/html: MIME type "application/ld+json: should be escaped as JS Teach the text/html package to understand the "application/ld+json" MIME type (used for JSON-LD data) as JS, so it can be apply the correct contextual escaping. Fixes #26053 --- src/html/template/js.go | 1 + src/html/template/js_test.go | 1 + 2 files changed, 2 insertions(+) diff --git a/src/html/template/js.go b/src/html/template/js.go index 33a18b41864cc7..2b0af328f82610 100644 --- a/src/html/template/js.go +++ b/src/html/template/js.go @@ -391,6 +391,7 @@ func isJSType(mimeType string) bool { "application/ecmascript", "application/javascript", "application/json", + "application/ld+json", "application/x-ecmascript", "application/x-javascript", "text/ecmascript", diff --git a/src/html/template/js_test.go b/src/html/template/js_test.go index 12a850d6e3bfe6..05fa105be02c70 100644 --- a/src/html/template/js_test.go +++ b/src/html/template/js_test.go @@ -343,6 +343,7 @@ func TestIsJsMimeType(t *testing.T) { {"application/javascript/version=1.8", false}, {"text/javascript", true}, {"application/json", true}, + {"application/ld+json", true}, } for _, test := range tests {