Skip to content

Commit

Permalink
Merge pull request Intervention#983 from damiengrandi/patch-1
Browse files Browse the repository at this point in the history
Bugfix for decodeDataUrl when data contains newlines
  • Loading branch information
olivervogel authored Jul 5, 2021
2 parents 8e5d38f + e2d032d commit 94c1799
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 @@ -295,7 +295,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 94c1799

Please sign in to comment.