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 22, 2024
1 parent b4026d3 commit 059ac9d
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: this._escapeHTML(term) };
}

_isValid() {
Expand Down

0 comments on commit 059ac9d

Please sign in to comment.