panel 2 courier api restore
This commit is contained in:
parent
d5cf92f042
commit
817c21454e
@ -103,10 +103,14 @@ export async function decodeEmail(emailContent: string): Promise<ParsedEmail> {
|
||||
|
||||
export function cleanHtml(html: string): string {
|
||||
try {
|
||||
// Enhanced configuration to preserve more HTML elements for complex emails
|
||||
return DOMPurify.sanitize(html, {
|
||||
ALLOWED_TAGS: ['p', 'br', 'div', 'span', 'a', 'img', 'strong', 'em', 'u', 'ul', 'ol', 'li', 'blockquote', 'pre', 'code', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'],
|
||||
ALLOWED_ATTR: ['href', 'src', 'alt', 'title', 'class', 'style'],
|
||||
ALLOWED_URI_REGEXP: /^(?:(?:(?:f|ht)tps?|mailto|tel):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
|
||||
ADD_TAGS: ['style', 'meta', 'link', 'table', 'thead', 'tbody', 'tr', 'td', 'th', 'hr'],
|
||||
ADD_ATTR: ['*', 'colspan', 'rowspan', 'cellpadding', 'cellspacing', 'border', 'bgcolor', 'width', 'height', 'align', 'valign', 'class', 'id', 'style'],
|
||||
ALLOW_UNKNOWN_PROTOCOLS: true,
|
||||
WHOLE_DOCUMENT: true,
|
||||
KEEP_CONTENT: true,
|
||||
RETURN_DOM: false
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('Error cleaning HTML:', error);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user