From 0551a7f8db043f0e6116c8d548448d29c6d640d6 Mon Sep 17 00:00:00 2001 From: Tiddo Nees Date: Sat, 2 Nov 2024 19:02:55 +0000 Subject: [PATCH] Revert "Revert "Merge branch 'master' into vtk-master"" This reverts commit 63ee4989ce8bd514acb42e381d84339e2706e74e --- .../Controller/ActionController/ApiController.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/module/ApiBundle/Component/Controller/ActionController/ApiController.php b/module/ApiBundle/Component/Controller/ActionController/ApiController.php index 10851eff3..7ab1e2ee5 100644 --- a/module/ApiBundle/Component/Controller/ActionController/ApiController.php +++ b/module/ApiBundle/Component/Controller/ActionController/ApiController.php @@ -101,14 +101,18 @@ public function onDispatch(MvcEvent $e) ) ) { $error = $this->error(401, 'You do not have sufficient permissions to access this resource'); - $error->setOptions($result->getOptions()); + if ($result instanceof \Laminas\View\Model\ViewModel) { + $error->setOptions($result->getOptions()); + } $e->setResult($error); return $error; } } else { $error = $this->error(401, 'No key or OAuth token was provided or the token was invalid'); - $error->setOptions($result->getOptions()); + if ($result instanceof \Laminas\View\Model\ViewModel) { + $error->setOptions($result->getOptions()); + } $e->setResult($error); return $error;