aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/AppFramework/Http
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2024-11-27 09:26:26 +0100
committerJoas Schilling <coding@schilljs.com>2024-11-28 12:18:30 +0100
commit1909b981a4b3db83edfcd76fb4b6730a0cc8da81 (patch)
tree1cdf62eb69c03acf153427af05eeebf6f7a06a96 /lib/private/AppFramework/Http
parent14f7e566c4cfca78d22706321b8f0b6cf4878ddb (diff)
downloadnextcloud-server-1909b981a4b3db83edfcd76fb4b6730a0cc8da81.tar.gz
nextcloud-server-1909b981a4b3db83edfcd76fb4b6730a0cc8da81.zip
fix(controller): Fix false booleans in multipart/form-data
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/private/AppFramework/Http')
-rw-r--r--lib/private/AppFramework/Http/Dispatcher.php12
1 files changed, 2 insertions, 10 deletions
diff --git a/lib/private/AppFramework/Http/Dispatcher.php b/lib/private/AppFramework/Http/Dispatcher.php
index e2750e30fa9..d63a9108b47 100644
--- a/lib/private/AppFramework/Http/Dispatcher.php
+++ b/lib/private/AppFramework/Http/Dispatcher.php
@@ -183,16 +183,8 @@ class Dispatcher {
$value = $this->request->getParam($param, $default);
$type = $this->reflector->getType($param);
- // if this is submitted using GET or a POST form, 'false' should be
- // converted to false
- if (($type === 'bool' || $type === 'boolean') &&
- $value === 'false' &&
- (
- $this->request->method === 'GET' ||
- str_contains($this->request->getHeader('Content-Type'),
- 'application/x-www-form-urlencoded')
- )
- ) {
+ // Converted the string `'false'` to false when the controller wants a boolean
+ if ($value === 'false' && ($type === 'bool' || $type === 'boolean')) {
$value = false;
} elseif ($value !== null && \in_array($type, $types, true)) {
settype($value, $type);