mirror of
https://github.com/Intervention/image.git
synced 2025-09-03 02:42: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:
@@ -290,7 +290,7 @@ abstract class AbstractDecoder
|
|||||||
}
|
}
|
||||||
|
|
||||||
$pattern = "/^data:(?:image\/[a-zA-Z\-\.]+)(?:charset=\".+\")?;base64,(?P<data>.+)$/";
|
$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)) {
|
if (is_array($matches) && array_key_exists('data', $matches)) {
|
||||||
return base64_decode($matches['data']);
|
return base64_decode($matches['data']);
|
||||||
|
Reference in New Issue
Block a user