Skip to content

Commit

Permalink
fix(app-store): Ensure the groups property is always an array
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
susnux authored and backportbot[bot] committed Oct 23, 2024
1 parent 0fef593 commit 35a1d4b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions apps/settings/lib/Controller/AppSettingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,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'];
Expand Down

0 comments on commit 35a1d4b

Please sign in to comment.