From 9955b135642a805ff5fc3ec91ba1d969b7385c5e Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Wed, 23 Oct 2024 12:57:29 +0200 Subject: [PATCH] fix(app-store): Ensure the `groups` property is always an array If the value was a string, like a single group, then `json_decode` will also yield only a string. So in this case we ensure the property is always an array with that value. Signed-off-by: Ferdinand Thiessen --- apps/settings/lib/Controller/AppSettingsController.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/apps/settings/lib/Controller/AppSettingsController.php b/apps/settings/lib/Controller/AppSettingsController.php index 7a1e5dd71571e..b70978a3b9278 100644 --- a/apps/settings/lib/Controller/AppSettingsController.php +++ b/apps/settings/lib/Controller/AppSettingsController.php @@ -307,6 +307,10 @@ public function listApps(): JSONResponse { $groups = []; if (is_string($appData['groups'])) { $groups = json_decode($appData['groups']); + // ensure 'groups' is an array + if (!is_array($groups)) { + $groups = [$groups]; + } } $appData['groups'] = $groups; $appData['canUnInstall'] = !$appData['active'] && $appData['removable'];