1
0
mirror of https://github.com/Intervention/image.git synced 2025-09-01 18:02:45 +02:00

Bugfix for DataUrl containing newlines inside data

Remove the newlines before doing a Regex check inside the decodeDataUrl method in the same way that is the isBase64 method doing.
This commit is contained in:
Damien Grandi
2019-11-06 12:09:51 +01:00
committed by GitHub
parent a59085a161
commit e2d032dc15

View File

@@ -290,7 +290,7 @@ abstract class AbstractDecoder
}
$pattern = "/^data:(?:image\/[a-zA-Z\-\.]+)(?:charset=\".+\")?;base64,(?P<data>.+)$/";
preg_match($pattern, $data_url, $matches);
preg_match($pattern, str_replace(["\n", "\r"], '', $data_url), $matches);
if (is_array($matches) && array_key_exists('data', $matches)) {
return base64_decode($matches['data']);