diff options
author | Julius Härtl <jus@bitgrid.net> | 2020-09-10 09:37:19 +0300 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2020-09-10 09:37:19 +0300 |
commit | 625d949ba131ef8aff32b6a99e1d3a90b8dbda86 (patch) | |
tree | 1acd1bc12b5be842fc30de148dfe33cb1cb33302 /lib | |
parent | 8a3d6c6e06b725cbd5c582215bbe1b2f2f38a167 (diff) |
Properly check value types when updating watermark settings
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'lib')
-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 = [ |