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>
pull/48853/head
Ferdinand Thiessen 2024-10-23 12:57:29 +07:00
parent 74cd6e295a
commit 9955b13564
No known key found for this signature in database
GPG Key ID: 45FAE7268762B400
1 changed files with 4 additions and 0 deletions

@ -307,6 +307,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'];