fix: [API] Correctly embed attributes and the event metadata in the object via /objects/view/[ID]

pull/4419/head
iglocska 2019-04-04 10:35:53 +02:00
parent 7b9c1c9f24
commit 31ac700a15
1 changed files with 8 additions and 1 deletions

View File

@ -612,7 +612,14 @@ class ObjectsController extends AppController
if ($this->_isRest()) {
$objects = $this->MispObject->fetchObjects($this->Auth->user(), array('conditions' => array('Object.id' => $id)));
if (!empty($objects)) {
return $this->RestResponse->viewData($objects[0], $this->response->type());
$object = $objects[0];
if (!empty($object['Event'])) {
$object['Object']['Event'] = $object['Event'];
}
if (!empty($object['Attribute'])) {
$object['Object']['Attribute'] = $object['Attribute'];
}
return $this->RestResponse->viewData(array('Object' => $object['Object']), $this->response->type());
}
}
}