Skip to content

Commit

Permalink
Bugfix for DataUrl containing newlines inside data
Browse files Browse the repository at this point in the history
Remove the newlines before doing a Regex check inside the decodeDataUrl method in the same way that is the isBase64 method doing.
  • Loading branch information
damiengrandi authored Nov 6, 2019
1 parent a59085a commit e2d032d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Intervention/Image/AbstractDecoder.php
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ private function decodeDataUrl($data_url)
}

$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']);
Expand Down

0 comments on commit e2d032d

Please sign in to comment.