Skip to content

Commit

Permalink
Merge pull request #874 from vitalyavolyn/open-links-new-tab
Browse files Browse the repository at this point in the history
Preserve target=_blank attribute when purifying (fix #793)
  • Loading branch information
dimdenGD authored Jul 13, 2024
2 parents 860719f + f7e2380 commit ebf37b5
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 ebf37b5

Please sign in to comment.