mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-20 21:15:01 +00:00
fix: Handle unsanitized markup in DOM (#4110)
This commit is contained in:
@@ -47,7 +47,12 @@ class MessageFormatter {
|
||||
const markedDownOutput = marked(withHash);
|
||||
return markedDownOutput;
|
||||
}
|
||||
return marked(this.message, { breaks: true, gfm: true });
|
||||
DOMPurify.addHook('afterSanitizeAttributes', node => {
|
||||
if ('target' in node) node.setAttribute('target', '_blank');
|
||||
});
|
||||
return DOMPurify.sanitize(
|
||||
marked(this.message, { breaks: true, gfm: true })
|
||||
);
|
||||
}
|
||||
|
||||
get formattedMessage() {
|
||||
|
||||
Reference in New Issue
Block a user