Fixes #956. Return 404 for missing objects in GenericEntityApiController.php

This commit is contained in:
fipwmaqzufheoxq92ebc 2020-08-21 12:50:36 +02:00
parent cf9bb87f6e
commit 68f214ff29
2 changed files with 14 additions and 0 deletions

View File

@ -50,6 +50,10 @@ class GenericEntityApiController extends BaseApiController
} }
$object = $this->getDatabase()->{$args['entity']}($args['objectId']); $object = $this->getDatabase()->{$args['entity']}($args['objectId']);
if ($object == null) {
return $this->GenericErrorResponse($response, 'Object not found', 404);
}
$object['userfields'] = $userfields; $object['userfields'] = $userfields;
return $this->ApiResponse($response, $object); return $this->ApiResponse($response, $object);

View File

@ -395,6 +395,16 @@
} }
} }
} }
},
"404": {
"description": "Object not found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/GenericErrorResponse"
}
}
}
} }
} }
}, },