Skip to content

Commit

Permalink
ELEMENTS-1744: Collection label showing incorrect collection name in …
Browse files Browse the repository at this point in the history
…right panel
  • Loading branch information
rahuljain-dev committed May 21, 2024
1 parent bfde0d9 commit 8d52c00
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion ui/actions/nuxeo-add-to-collection-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,25 @@ import '../nuxeo-button-styles.js';
return item.id === -1 ? label : escapeHTML(label);
}

_escapeHTML(markup) {
const replaceMap = {
'\\': '\',
'&': '&',
'<': '&lt;',
'>': '&gt;',
'/': '&#47;',
};

// Do not try to escape the markup if it's not a string
if (typeof markup !== 'string') {
return markup;
}

return String(markup).replace(/[&<>"'/\\]/g, (match) => replaceMap[match]);
};

_newEntryFormatter(term) {
return { id: -1, displayLabel: escapeHTML(term) };
return { id: -1, displayLabel: _escapeHTML(term) };

Check failure on line 275 in ui/actions/nuxeo-add-to-collection-button.js

View workflow job for this annotation

GitHub Actions / lint

'_escapeHTML' is not defined
}

_isValid() {
Expand Down

0 comments on commit 8d52c00

Please sign in to comment.