diff options
author | Julius Härtl <jus@bitgrid.net> | 2020-09-10 16:10:10 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-10 16:10:10 +0300 |
commit | 0bcbe3c32afdb961a7a9e79a6f0b25e004af1853 (patch) | |
tree | 76d1ac4ea187e9fef56166518e6d51a7c9f6e205 | |
parent | 1123c2be7356dbf1601492de0324a267ac053dbd (diff) | |
parent | 625d949ba131ef8aff32b6a99e1d3a90b8dbda86 (diff) |
Merge pull request #1152 from nextcloud/bugfix/1151
Properly check value types when updating watermark settings
-rw-r--r-- | lib/Controller/SettingsController.php | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/Controller/SettingsController.php b/lib/Controller/SettingsController.php index 24a7f1ad..ef3e2a04 100644 --- a/lib/Controller/SettingsController.php +++ b/lib/Controller/SettingsController.php @@ -232,12 +232,15 @@ class SettingsController extends Controller{ 'data' => ['message' => $this->l10n->t('Invalid config key') . ' ' . $fullKey] ], Http::STATUS_BAD_REQUEST); } - $value = $value === true ? 'yes' : $value; - $value = $value === false ? 'no' : $value; - if (AppConfig::APP_SETTING_TYPES[$fullKey] === 'array') { - $value = implode(',', $value); + $parsedValue = $value; + if (is_bool($value)) { + $parsedValue = $value ? 'yes' : 'no'; } - $this->appConfig->setAppValue($fullKey, $value); + $appSettingsType = isset(AppConfig::APP_SETTING_TYPES[$fullKey]) ? AppConfig::APP_SETTING_TYPES[$fullKey] : 'string'; + if ($appSettingsType === 'array') { + $parsedValue = implode(',', $value); + } + $this->appConfig->setAppValue($fullKey, $parsedValue); } $response = [ |