diff --git a/CHANGELOG.md b/CHANGELOG.md index fa005c6d0..abef15792 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ Notable changes to Mailpit will be documented in this file. +## [v1.21.4] + +### Bugfix +- Fix external CSS stylesheet loading in HTML preview ([#388](https://github.com/axllent/mailpit/issues/388)) + + ## [v1.21.3] ### Chore diff --git a/server/ui-src/components/message/Message.vue b/server/ui-src/components/message/Message.vue index 6794f0ae3..a233c513c 100644 --- a/server/ui-src/components/message/Message.vue +++ b/server/ui-src/components/message/Message.vue @@ -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) { @@ -115,7 +116,7 @@ export default { 'vertical-align', 'vlink', 'vspace', - 'xml:lang' + 'xml:lang', ], FORBID_ATTR: ['script'], }