]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix(app-store): Ensure the `groups` property is always an array refactor/appstore-modernization
authorFerdinand Thiessen <opensource@fthiessen.de>
Wed, 23 Oct 2024 10:57:29 +0000 (12:57 +0200)
committerFerdinand Thiessen <opensource@fthiessen.de>
Wed, 23 Oct 2024 11:02:06 +0000 (13:02 +0200)
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 <opensource@fthiessen.de>
apps/settings/lib/Controller/AppSettingsController.php

index f50338c3923598661d3f16e83467f350867a45b4..b227d8155975fb81772e6fb6bade60f451c47732 100644 (file)
@@ -317,6 +317,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;