Skip to content

Commit

Permalink
Bugfix: Fix external CSS stylesheet loading in HTML preview (#388)
Browse files Browse the repository at this point in the history
  • Loading branch information
axllent committed Nov 17, 2024
1 parent 249a02b commit f08a959
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions server/ui-src/components/message/Message.vue
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,9 @@ export default {
// remove bad HTML, JavaScript, iframes etc
sanitizedHTML() {
// set target & rel on all links
DOMPurify.addHook('afterSanitizeAttributes', (node) => {
if (node.hasAttribute('href') && node.getAttribute('href').substring(0, 1) == '#') {
if (node.tagName != 'A' || (node.hasAttribute('href') && node.getAttribute('href').substring(0, 1) == '#')) {
return
}
if ('target' in node) {
Expand Down Expand Up @@ -115,7 +116,7 @@ export default {
'vertical-align',
'vlink',
'vspace',
'xml:lang'
'xml:lang',
],
FORBID_ATTR: ['script'],
}
Expand Down

0 comments on commit f08a959

Please sign in to comment.