Skip to content

Commit

Permalink
DIMOC-93 fix get publication attachments if publication does not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
WilcoLouwerse committed Aug 12, 2024
1 parent 64b103d commit 2f715e8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/Controller/PublicationsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'
) {
Expand Down

0 comments on commit 2f715e8

Please sign in to comment.