Outlook conditional comments <![if !vml]> / <![endif]> shown as text in thread body #5676 from il2020/vml-fix
Outlook conditional comments <![if !vml]> / <![endif]> shown as text in thread body
This commit is contained in:
@@ -1598,8 +1598,12 @@ class FetchEmails extends Command
|
||||
$body = \Eventy::filter('fetch_emails.separate_reply.preprocess_body', $body ?? '');
|
||||
|
||||
if ($is_html) {
|
||||
// Remove Outlook "downlevel-revealed" conditional comments (<![if !vml]>...<![endif]>),
|
||||
// preserving the data inside. Otherwise DOMDocument turns them into escaped text.
|
||||
$body = preg_replace('/<!\[(?:if\s[^\]]*|endif)\]>/i', '', $body) ?: $body;
|
||||
|
||||
// Extract body content from HTML
|
||||
|
||||
|
||||
// Proton has it's own unique way of placing replies:
|
||||
// https://github.com/freescout-help-desk/freescout/issues/4537#issuecomment-2629836738
|
||||
if ($is_reply
|
||||
|
||||
@@ -329,6 +329,11 @@ class Thread extends Model
|
||||
// https://github.com/freescout-helpdesk/freescout/pull/3865#issuecomment-1990758149
|
||||
$body = preg_replace('/<!\-\-\[if [^>]+\]><!\-\->(.*?)<![ ]+\-\-<!\[endif\]\-\->/s', '$1', $body);
|
||||
|
||||
// Remove Outlook "downlevel-revealed" conditional comments (<![if !vml]>...<![endif]>),
|
||||
// preserving the data inside. Browsers ignore them, but the purifier escapes them as text.
|
||||
// Emails fetched before the fix have them already escaped (<![if !vml]>) in the DB.
|
||||
$body = preg_replace('/(?:<|<)!\[(?:if\s[^\]]*|endif)\](?:>|>)/i', '', $body) ?: $body;
|
||||
|
||||
// https://github.com/freescout-helpdesk/freescout/issues/3894
|
||||
// Remove <!--[if !mso]><!--> and <!--<![endif]--> comments, preserving the data inside
|
||||
//$body = preg_replace('/(<!\-\-\[if [^>]+\]>|<!\[endif\]\-\->)/', '', $body);
|
||||
|
||||
Reference in New Issue
Block a user