Skip to content

Commit 8f2e47a

Browse files
committed
MAGETWO-92931: HTML entities in product name do not display properly in breadcrumb
- fix unit test
1 parent 9eca6fd commit 8f2e47a

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

app/code/Magento/Catalog/Test/Unit/ViewModel/Product/BreadcrumbsTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,21 +153,21 @@ public function productJsonEncodeDataProvider() : array
153153
return [
154154
[
155155
$this->getObjectManager()->getObject(Product::class, ['data' => ['name' => 'Test ™']]),
156-
'{"breadcrumbs":{"categoryUrlSuffix":".\"html","userCategoryPathInUrl":0,"product":"Test \u2122"}}',
156+
'{"breadcrumbs":{"categoryUrlSuffix":"."html","userCategoryPathInUrl":0,"product":"Test \u2122"}}',
157157
],
158158
[
159159
$this->getObjectManager()->getObject(Product::class, ['data' => ['name' => 'Test "']]),
160-
'{"breadcrumbs":{"categoryUrlSuffix":".\"html","userCategoryPathInUrl":0,"product":"Test ""}}',
160+
'{"breadcrumbs":{"categoryUrlSuffix":"."html","userCategoryPathInUrl":0,"product":"Test ""}}',
161161
],
162162
[
163163
$this->getObjectManager()->getObject(Product::class, ['data' => ['name' => 'Test <b>x</b>']]),
164-
'{"breadcrumbs":{"categoryUrlSuffix":".\"html","userCategoryPathInUrl":0,"product":'
164+
'{"breadcrumbs":{"categoryUrlSuffix":".&quot;html","userCategoryPathInUrl":0,"product":'
165165
. '"Test &lt;b&gt;x&lt;\/b&gt;"}}',
166166
],
167167
[
168168
$this->getObjectManager()->getObject(Product::class, ['data' => ['name' => 'Test \'abc\'']]),
169169
'{"breadcrumbs":'
170-
. '{"categoryUrlSuffix":".\"html","userCategoryPathInUrl":0,"product":"Test &#039;abc&#039;"}}'
170+
. '{"categoryUrlSuffix":".&quot;html","userCategoryPathInUrl":0,"product":"Test &#039;abc&#039;"}}'
171171
],
172172
];
173173
}

app/code/Magento/Catalog/ViewModel/Product/Breadcrumbs.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public function getJsonConfiguration() : string
104104
return json_encode(
105105
[
106106
'breadcrumbs' => [
107-
'categoryUrlSuffix' => $this->getCategoryUrlSuffix(),
107+
'categoryUrlSuffix' => $this->escaper->escapeHtml($this->getCategoryUrlSuffix()),
108108
'userCategoryPathInUrl' => (int)$this->isCategoryUsedInProductUrl(),
109109
'product' => $this->escaper->escapeHtml($this->getProductName())
110110
]

0 commit comments

Comments
 (0)