Skip to content

Commit

Permalink
data
Browse files Browse the repository at this point in the history
  • Loading branch information
brianteeman committed Dec 2, 2023
1 parent 41b559d commit 39c0137
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion libraries/src/Mail/MailHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -218,13 +218,16 @@ public static function convertRelativeToAbsoluteUrls($content)

// Replace relative links, image sources with absolute Urls and lazyloading
$protocols = '[a-zA-Z0-9\-]+:';
$attributes = ['href=', 'src=', 'poster=', 'loading='];
$attributes = ['href=', 'src=', 'poster=', 'loading=', 'data-path='];

foreach ($attributes as $attribute) {
if (strpos($content, $attribute) !== false) {
// If the attribute is 'loading=', remove loading="lazy"
if ($attribute === 'loading=') {
$content = preg_replace('/\s' . $attribute . '"lazy"/i', '', $content);
} elseif ($attribute === 'data-path=') {
// If the attribute is 'data-path=', remove the entire attribute
$content = preg_replace('/\s' . $attribute . '"([^"]*)"/i', '', $content);
} else {
// Define a regular expression pattern for matching relative URLs in the specified attribute
$regex = '#\s' . $attribute . '"(?!/|' . $protocols . '|\#|\')([^"]*)"#m';
Expand Down

0 comments on commit 39c0137

Please sign in to comment.