Skip to content

Commit 5a3eea3

Browse files
committed
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
1 parent d6a27e8 commit 5a3eea3

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

src/html/template/js.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,7 @@ func isJSType(mimeType string) bool {
391391
"application/ecmascript",
392392
"application/javascript",
393393
"application/json",
394+
"application/ld+json",
394395
"application/x-ecmascript",
395396
"application/x-javascript",
396397
"text/ecmascript",

src/html/template/js_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,7 @@ func TestIsJsMimeType(t *testing.T) {
343343
{"application/javascript/version=1.8", false},
344344
{"text/javascript", true},
345345
{"application/json", true},
346+
{"application/ld+json", true},
346347
}
347348

348349
for _, test := range tests {

0 commit comments

Comments
 (0)