Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f91c198

Browse files
committed
bug #47329 Email image parts: regex for single closing quote (rr-it)
This PR was merged into the 4.4 branch. Discussion ---------- Email image parts: regex for single closing quote | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - The regex for image src matches for single and double opening quotes: `([\'"])` The corresponding matching for non-closing characters is implemented for double quotes only: `([^"]+)` This change adds a non-greedy regex `.+?` which matches for as few characters as possbile before the "correspondingly matched opening quote" `\\1` appears. Commits ------- 57c49b4 Email image parts: regex for single closing quote
2 parents d651770 + 57c49b4 commit f91c198

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Symfony/Component/Mime/Email.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ private function prepareParts(): ?array
503503
$html = stream_get_contents($html);
504504
}
505505
$htmlPart = new TextPart($html, $this->htmlCharset, 'html');
506-
preg_match_all('(<img\s+[^>]*src\s*=\s*(?:([\'"])cid:([^"]+)\\1|cid:([^>\s]+)))i', $html, $names);
506+
preg_match_all('(<img\s+[^>]*src\s*=\s*(?:([\'"])cid:(.+?)\\1|cid:([^>\s]+)))i', $html, $names);
507507
$names = array_filter(array_unique(array_merge($names[2], $names[3])));
508508
}
509509

0 commit comments

Comments
 (0)