Skip to content

Commit 151ff38

Browse files
authored
Merge pull request #41635 from nextcloud/fix/settings-apporder
fix(theming): Adjust config listener to validate `apporder` config also for closure navigation
2 parents f74084c + fa2c834 commit 151ff38

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

apps/theming/lib/Listener/BeforePreferenceListener.php

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,16 @@ private function handleCoreValues(BeforePreferenceSetEvent|BeforePreferenceDelet
7979
}
8080

8181
$value = json_decode($event->getConfigValue(), true, flags:JSON_THROW_ON_ERROR);
82-
if (is_array(($value))) {
83-
foreach ($value as $id => $info) {
84-
if (!is_array($info) || empty($info) || !isset($info['app']) || !$this->appManager->isEnabledForUser($info['app']) || !is_numeric($info['order'] ?? '')) {
85-
// Invalid config value, refuse the change
86-
return;
87-
}
82+
if (!is_array(($value))) {
83+
// Must be an array
84+
return;
85+
}
86+
87+
foreach ($value as $id => $info) {
88+
// required format: [ navigation_id: string => [ order: int, app?: string ] ]
89+
if (!is_string($id) || !is_array($info) || empty($info) || !isset($info['order']) || !is_numeric($info['order']) || (isset($info['app']) && !$this->appManager->isEnabledForUser($info['app']))) {
90+
// Invalid config value, refuse the change
91+
return;
8892
}
8993
}
9094
$event->setValid(true);

0 commit comments

Comments
 (0)