From 41a0f8d9afc3a9d29f26c4109620252a82002ae4 Mon Sep 17 00:00:00 2001 From: smizrahi Date: Wed, 4 Sep 2024 15:05:25 +0200 Subject: [PATCH] fix(mail): Fix HTML mail rendering issue --- UI/MailPartViewers/UIxMailPartHTMLViewer.m | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/UI/MailPartViewers/UIxMailPartHTMLViewer.m b/UI/MailPartViewers/UIxMailPartHTMLViewer.m index 6b0edac64..1930ad8c3 100644 --- a/UI/MailPartViewers/UIxMailPartHTMLViewer.m +++ b/UI/MailPartViewers/UIxMailPartHTMLViewer.m @@ -278,6 +278,9 @@ static NSString *_sanitizeHtmlForDisplay(NSString *content) unichar *sanitizedChars, *start, *currentChar; BOOL inComment; + if (rawContent) + return; + /** * Sanitize style * - remove control characters @@ -341,10 +344,11 @@ static NSString *_sanitizeHtmlForDisplay(NSString *content) } } } - if (!inComment && currentChar > start) + if (!inComment && currentChar > start) { + if (*currentChar == '}' && *currentChar++ == '\000') currentChar++; // Add offset [sanitizedStyle appendString: [NSString stringWithCharacters: start length: (currentChar - start)]]; - + } /** * Parse sanitized style * - remove at-rule definitions @@ -384,8 +388,7 @@ static NSString *_sanitizeHtmlForDisplay(NSString *content) (*(currentChar-7) == 'p' || *(currentChar-7) == 'P') && (*(currentChar-8) == 'm' || *(currentChar-8) == 'M') && (*(currentChar-9) == 'i' || *(currentChar-9) == 'I') && - *(currentChar-10) == '!') - && !rawContent) + *(currentChar-10) == '!')) { length = (currentChar - start); [declaration appendFormat: @"%@ !important;",