Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/richdocuments.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2020-09-10 09:37:19 +0300
committerJulius Härtl <jus@bitgrid.net>2020-09-10 09:37:19 +0300
commit625d949ba131ef8aff32b6a99e1d3a90b8dbda86 (patch)
tree1acd1bc12b5be842fc30de148dfe33cb1cb33302 /lib
parent8a3d6c6e06b725cbd5c582215bbe1b2f2f38a167 (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.php13
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 = [