Skip to content

Commit

Permalink
Fixed API create when source is an url
Browse files Browse the repository at this point in the history
  • Loading branch information
pensiero committed Feb 14, 2017
1 parent 1ce8c62 commit 32be243
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/ImageUploader/Controller/Api.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,12 @@ private function create(): array
{
// source passed via JSON request
if ($_SERVER['CONTENT_TYPE'] == 'application/json') {

$data = json_decode(file_get_contents('php://input'), true);
$source = base64_decode($data['source']);

$source = filter_var($data['source'], FILTER_VALIDATE_URL)
? $data['source']
: base64_decode($data['source']);
}
// source uploaded
else if (!empty($_FILES)) {
Expand Down

0 comments on commit 32be243

Please sign in to comment.