summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2023-02-13 10:25:52 +0100
committerGitHub <noreply@github.com>2023-02-13 10:25:52 +0100
commit610a203d31bcaeaeaf70688a02adde4aaabbdf03 (patch)
treed33ea041745e32beece16ac48533637f2ac748c1
parent73495b0fc486c862cb6abae190b92ffafe0b919b (diff)
parentdc3916e27c0693da85c354a999bf4e81518535a1 (diff)
downloadnextcloud-server-610a203d31bcaeaeaf70688a02adde4aaabbdf03.tar.gz
nextcloud-server-610a203d31bcaeaeaf70688a02adde4aaabbdf03.zip
Merge pull request #36525 from nextcloud/fix/noid/params-put
fix: Only get params from PUT content if possible
-rw-r--r--lib/private/AppFramework/Http/Request.php18
1 files changed, 12 insertions, 6 deletions
diff --git a/lib/private/AppFramework/Http/Request.php b/lib/private/AppFramework/Http/Request.php
index ac162f6565e..1f32d6c5461 100644
--- a/lib/private/AppFramework/Http/Request.php
+++ b/lib/private/AppFramework/Http/Request.php
@@ -260,6 +260,9 @@ class Request implements \ArrayAccess, \Countable, IRequest {
: null;
case 'parameters':
case 'params':
+ if ($this->isPutStreamContent()) {
+ return $this->items['parameters'];
+ }
return $this->getContent();
default:
return isset($this[$name])
@@ -391,12 +394,7 @@ class Request implements \ArrayAccess, \Countable, IRequest {
*/
protected function getContent() {
// If the content can't be parsed into an array then return a stream resource.
- if ($this->method === 'PUT'
- && $this->getHeader('Content-Length') !== '0'
- && $this->getHeader('Content-Length') !== ''
- && strpos($this->getHeader('Content-Type'), 'application/x-www-form-urlencoded') === false
- && strpos($this->getHeader('Content-Type'), 'application/json') === false
- ) {
+ if ($this->isPutStreamContent()) {
if ($this->content === false) {
throw new \LogicException(
'"put" can only be accessed once if not '
@@ -411,6 +409,14 @@ class Request implements \ArrayAccess, \Countable, IRequest {
}
}
+ private function isPutStreamContent(): bool {
+ return $this->method === 'PUT'
+ && $this->getHeader('Content-Length') !== '0'
+ && $this->getHeader('Content-Length') !== ''
+ && strpos($this->getHeader('Content-Type'), 'application/x-www-form-urlencoded') === false
+ && strpos($this->getHeader('Content-Type'), 'application/json') === false;
+ }
+
/**
* Attempt to decode the content and populate parameters
*/