Skip to content

Commit b9d2e53

Browse files
committed
#13296: Category name with special characters brakes … #13397
1 parent 30989e1 commit b9d2e53

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

app/code/Magento/Catalog/view/adminhtml/web/js/category-tree.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55

66
define([
77
'jquery',
8-
'underscore',
8+
'mageUtils',
99
'jquery/ui',
1010
'jquery/jstree/jquery.jstree'
11-
], function ($, _) {
11+
], function ($, utils) {
1212
'use strict';
1313

1414
$.widget('mage.categoryTree', {
@@ -91,7 +91,7 @@ define([
9191
}
9292
result = {
9393
data: {
94-
title: _.unescape(node.name) + ' (' + node['product_count'] + ')'
94+
title: utils.unescape(node.name) + ' (' + node['product_count'] + ')'
9595
},
9696
attr: {
9797
'class': node.cls + (!!node.disabled ? ' disabled' : '') //eslint-disable-line no-extra-boolean-cast

lib/web/mage/utils/misc.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,26 @@ define([
242242
return data;
243243
},
244244

245+
/**
246+
* Replaces symbol codes with their unescaped counterparts.
247+
*
248+
* @param {String} data
249+
*
250+
* @returns {String}
251+
*/
252+
unescape: function (data) {
253+
var unescaped = _.unescape(data),
254+
map = {
255+
''': '\''
256+
};
257+
258+
_.each(map, function (value, key) {
259+
unescaped = unescaped.replace(key, value);
260+
});
261+
262+
return unescaped;
263+
},
264+
245265
/**
246266
* Converts PHP IntlFormatter format to moment format.
247267
*

0 commit comments

Comments
 (0)