diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/AppFramework/Http/Request.php | 5 | ||||
-rw-r--r-- | lib/public/IRequest.php | 5 |
2 files changed, 6 insertions, 4 deletions
diff --git a/lib/private/AppFramework/Http/Request.php b/lib/private/AppFramework/Http/Request.php index e4219cefd70..3764ce5c7f8 100644 --- a/lib/private/AppFramework/Http/Request.php +++ b/lib/private/AppFramework/Http/Request.php @@ -107,9 +107,6 @@ class Request implements \ArrayAccess, \Countable, IRequest { /** @var bool */ protected $contentDecoded = false; - /** @var string */ - protected string $jsonContentTypeRegex = '{^application/(?:[a-z0-9.-]+\+)?json\b}'; - /** * @param array $vars An associative array with the following optional values: * - array 'urlParams' the parameters which were matched from the URL @@ -433,7 +430,7 @@ class Request implements \ArrayAccess, \Countable, IRequest { $params = []; // 'application/json' and other JSON-related content types must be decoded manually. - if (preg_match($this->jsonContentTypeRegex, $this->getHeader('Content-Type')) === 1) { + if (preg_match(self::JSON_CONTENT_TYPE_REGEX, $this->getHeader('Content-Type')) === 1) { $params = json_decode(file_get_contents($this->inputStream), true); if ($params !== null && \count($params) > 0) { $this->items['params'] = $params; diff --git a/lib/public/IRequest.php b/lib/public/IRequest.php index 7696c3fa8c3..26d0179bc2f 100644 --- a/lib/public/IRequest.php +++ b/lib/public/IRequest.php @@ -98,6 +98,11 @@ interface IRequest { public const USER_AGENT_THUNDERBIRD_ADDON = '/^Mozilla\/5\.0 \([A-Za-z ]+\) Nextcloud\-Thunderbird v.*$/'; /** + * @var string + */ + public const JSON_CONTENT_TYPE_REGEX = '{^application/(?:[a-z0-9.-]+\+)?json\b}'; + + /** * @param string $name * * @psalm-taint-source input |