From 35a1d4b224124878a4ded4d88ef32df48b315c87 Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Wed, 23 Oct 2024 12:57:29 +0200 Subject: 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(+) (limited to 'apps') diff --git a/apps/settings/lib/Controller/AppSettingsController.php b/apps/settings/lib/Controller/AppSettingsController.php index ccd0b418040..9416381ff49 100644 --- a/apps/settings/lib/Controller/AppSettingsController.php +++ b/apps/settings/lib/Controller/AppSettingsController.php @@ -306,6 +306,10 @@ class AppSettingsController extends Controller { $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']; -- cgit v1.2.3