Skip to content

Commit

Permalink
馃帹 escape sameAs for structured data (#7833)
Browse files Browse the repository at this point in the history
closes #7832

- escape output for json-ld
  • Loading branch information
kirrg001 authored and kevinansfield committed Jan 10, 2017
1 parent 7cd13e6 commit 8031102
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions core/server/data/meta/schema.js
Expand Up @@ -41,7 +41,7 @@ function trimSameAs(data, context) {

if (context === 'post') {
if (data.post.author.website) {
sameAs.push(data.post.author.website);
sameAs.push(escapeExpression(data.post.author.website));
}
if (data.post.author.facebook) {
sameAs.push(socialUrls.facebookUrl(data.post.author.facebook));
Expand All @@ -51,7 +51,7 @@ function trimSameAs(data, context) {
}
} else if (context === 'author') {
if (data.author.website) {
sameAs.push(data.author.website);
sameAs.push(escapeExpression(data.author.website));
}
if (data.author.facebook) {
sameAs.push(socialUrls.facebookUrl(data.author.facebook));
Expand Down
4 changes: 2 additions & 2 deletions core/test/unit/metadata/schema_spec.js
Expand Up @@ -437,7 +437,7 @@ describe('getSchema', function () {
context: ['author'],
author: {
name: 'Author Name',
website: 'http://myblogsite.com/',
website: 'http://myblogsite.com/?user=bambedibu&a=<script>alert("bambedibu")</script>',
twitter: '@testuser'
}
}, schema = getSchema(metadata, data);
Expand All @@ -452,7 +452,7 @@ describe('getSchema', function () {
},
name: 'Author Name',
sameAs: [
'http://myblogsite.com/',
'http://myblogsite.com/?user&#x3D;bambedibu&amp;a&#x3D;&lt;script&gt;alert(&quot;bambedibu&quot;)&lt;/script&gt;',
'https://twitter.com/testuser'
],
url: 'http://mysite.com/author/me/'
Expand Down

0 comments on commit 8031102

Please sign in to comment.