Skip to content

Commit a49a6ec

Browse files
committed
Merge remote-tracking branch 'troll/MAGETWO-48511' into troll-bugs
2 parents 06c71d6 + fe1eb2f commit a49a6ec

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

app/code/Magento/Catalog/view/frontend/templates/product/view/opengraph/general.phtml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
?>
1111

1212
<meta property="og:type" content="og:product" />
13-
<meta property="og:title" content="<?php /* @escapeNotVerified */ echo $block->stripTags($block->getProduct()->getName()); ?>" />
14-
<meta property="og:image" content="<?php /* @escapeNotVerified */ echo $block->stripTags($block->getImage($block->getProduct(), 'product_base_image')->getImageUrl()); ?>" />
15-
<meta property="og:description" content="<?php /* @escapeNotVerified */ echo $block->stripTags($block->getProduct()->getShortDescription()); ?>" />
16-
<meta property="og:url" content="<?php /* @escapeNotVerified */ echo $block->stripTags($block->getProduct()->getProductUrl()); ?>" />
13+
<meta property="og:title" content="<?php echo $block->escapeHtml($block->getProduct()->getName()); ?>" />
14+
<meta property="og:image" content="<?php echo $block->escapeHtml($block->getImage($block->getProduct(), 'product_base_image')->getImageUrl()); ?>" />
15+
<meta property="og:description" content="<?php echo $block->escapeHtml($block->getProduct()->getShortDescription()); ?>" />
16+
<meta property="og:url" content="<?php echo $block->escapeHtml($block->getProduct()->getProductUrl()); ?>" />
1717
<?php if ($priceAmount = $block->getProduct()->getFinalPrice()):?>
1818
<meta property="product:price:amount" content="<?php /* @escapeNotVerified */ echo $priceAmount; ?>"/>
1919
<?php echo $block->getChildHtml('meta.currency'); ?>

lib/internal/Magento/Framework/View/Page/Config.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ public function getTitle()
216216
public function setMetadata($name, $content)
217217
{
218218
$this->build();
219-
$this->metadata[$name] = $content;
219+
$this->metadata[$name] = htmlentities($content);
220220
}
221221

222222
/**

lib/internal/Magento/Framework/View/Test/Unit/Page/ConfigTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,10 @@ public function testMetadata()
133133
'keywords' => null,
134134
'robots' => null,
135135
'name' => 'test_value',
136+
'html_encoded' => '&lt;title&gt;&lt;span class=&quot;test&quot;&gt;Test&lt;/span&gt;&lt;/title&gt;',
136137
];
137138
$this->model->setMetadata('name', 'test_value');
139+
$this->model->setMetadata('html_encoded', '<title><span class="test">Test</span></title>');
138140
$this->assertEquals($expectedMetadata, $this->model->getMetadata());
139141
}
140142

0 commit comments

Comments
 (0)