Skip to content

Commit

Permalink
Preserve target=_blank attribute when purifying (fix #793)
Browse files Browse the repository at this point in the history
  • Loading branch information
vitalyavolyn committed Jul 13, 2024
1 parent 7b45404 commit f7e2380
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion scripts/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,8 @@ function escapeHTML(unsafe) {
if(typeof unsafe === 'undefined' || unsafe === null) {
return '';
}
return DOMPurify.sanitize(String(unsafe));

return DOMPurify.sanitize(String(unsafe), { ADD_ATTR: ['target'] });
}

function html(strings, ...values) {
Expand Down

0 comments on commit f7e2380

Please sign in to comment.