10000 Email image parts: regex for single closing quote · symfony/symfony@57c49b4 · GitHub
[go: up one dir, main page]

Skip to content

Commit 57c49b4

Browse files
authored
Email image parts: regex for single closing quote
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.
1 parent d651770 commit 57c49b4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Symfony/Component/Mime/Email.php

Lines changed: 1 addition & 1 deletion
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)
0