Skip to content

Commit

Permalink
Import: require input to be parsed properly
Browse files Browse the repository at this point in the history
Do not call saver if input is not in expected format (array).
  • Loading branch information
glensc committed Dec 14, 2020
1 parent acd8491 commit 0f82565
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Xhgui/Controller/ImportController.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ private function runImport(Request $request): string
}

$data = json_decode($request->getBody(), true);
if (!is_array($data)) {
throw new InvalidArgumentException('Failed do decode payload');
}

return $this->saver->save($data);
}
Expand Down

0 comments on commit 0f82565

Please sign in to comment.