1
0
mirror of https://github.com/axllent/mailpit.git synced 2024-12-28 23:06:43 +02:00

Bugfix: Fix external CSS stylesheet loading in HTML preview (#388)

This commit is contained in:
Ralph Slooten 2024-11-17 17:49:15 +13:00
parent 249a02b71a
commit f08a959545

View File

@ -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'],
}