Skip to content

Commit

Permalink
Merge pull request #6883 from g-fantini/bugfix/#6882
Browse files Browse the repository at this point in the history
fixed bug that removes Email_Address_Removed_In_Email_Body if email i…
  • Loading branch information
code-ph0y committed May 3, 2019
2 parents f083cf0 + 39a343e commit c1988a0
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions include/HtmlSanitizer.php
Expand Up @@ -112,6 +112,10 @@ public static function cleanHtml($dirtyHtml, $removeHtml = false)
{
// $encode_html previously effected the decoding process.
// we should decode regardless, just in case, the calling method passing encoded html
//Prevent that the email address in Outlook format are removed
$pattern = '/(.*)(<([a-zA-Z0-9.!#$%&\'*+\=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)>)(.*)/';
$replacement = '${1}<<a href="mailto:${3}">${3}</a>> ${4}';
$dirtyHtml = preg_replace($pattern, $replacement, $dirtyHtml);
$dirty_html_decoded = html_entity_decode($dirtyHtml);

// Re-encode html
Expand Down

0 comments on commit c1988a0

Please sign in to comment.