Commit 72af3eaa authored by Karamel's avatar Karamel
Browse files

Send 404 response when no image is set in GET api/image/{model}/{id}.

parent ae166681
......@@ -37,6 +37,10 @@ $app->GET('/api/image/{model}/{id}', function($request, $response, $args) {
[['model' => $args['model'], 'modelId' =>$args['id']]]);
if ($imgCall->getStatus() == APIResult::STATUS_CALL_OK) {
$img = $imgCall->getContent();
if ($img === null) {
$response->withStatus(404, "Image not found");
return $response;
}
$mime = $img->getMimeType();
$data = $img->getImage();
$response = $response->withStatus(200);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment