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 <opensource@fthiessen.de>
This commit is contained in:
Ferdinand Thiessen 2024-10-23 12:57:29 +02:00 committed by backportbot[bot]
parent 0fef593f7b
commit 35a1d4b224

View file

@ -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'];