Skip to content

Commit 342126d

Browse files
committed
AC-3223::Special characters in category url_key (when created via REST API)
1 parent 0d973fe commit 342126d

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

app/code/Magento/Catalog/Plugin/Model/CategoryRepositoryPlugin.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,11 @@ class CategoryRepositoryPlugin
3232
public function beforeSave(CategoryRepository $subject, CategoryInterface $category): array
3333
{
3434
foreach (self::ATTRIBUTES_TO_PROCESS as $attributeKey) {
35-
if ($attribute = $category->getCustomAttribute($attributeKey)) {
36-
$attribute->setValue($category->formatUrlKey(
37-
$category->getData($attributeKey)
38-
));
35+
$attribute = $category->getCustomAttribute($attributeKey);
36+
if ($attribute !== null) {
37+
$value = $category->getData($attributeKey);
38+
$formattedValue = $category->formatUrlKey($value);
39+
$attribute->setValue($formattedValue);
3940
}
4041
}
4142
return [$category];

app/code/Magento/Catalog/etc/webapi_rest/di.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0"?>
22
<!--
33
/**
4-
* Copyright © Magento, Inc. All rights reserved.
5-
* See COPYING.txt for license details.
4+
* Copyright 2014 Adobe
5+
* All Rights Reserved.
66
*/
77
-->
88

0 commit comments

Comments
 (0)