diff --git a/lib/Controller/PublicationsController.php b/lib/Controller/PublicationsController.php index b4022286..68e34e0b 100644 --- a/lib/Controller/PublicationsController.php +++ b/lib/Controller/PublicationsController.php @@ -154,7 +154,12 @@ public function index(ObjectService $objectService, SearchService $searchService */ public function attachments(string|int $id, ObjectService $objectService): JSONResponse { - $publication = $this->show($id, $objectService)->getData(); + $jsonResponse = $this->show($id, $objectService); + $publication = $jsonResponse->getData(); + if (is_array($publication) === true && isset($publication['error']) === true) { + return new JSONResponse(data: $publication, statusCode: $jsonResponse->getStatus()); + } + if ($this->config->hasKey(app: $this->appName, key: 'mongoStorage') === false || $this->config->getValueString(app: $this->appName, key: 'mongoStorage') !== '1' ) {