Skip to content

Commit 213e493

Browse files
committed
Support strict typing in NC14 for IRequest::getHeader()
(nextcloud/server/pull/7813)
1 parent deeeabc commit 213e493

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

lib/Middleware/ExternalApiMiddleware.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function beforeController($controller, $methodName)
3737
$jsxcSignatureHeader = $this->request->getHeader('X-JSXC-SIGNATURE');
3838

3939
// check if we have a signature
40-
if (! isset($jsxcSignatureHeader)) {
40+
if ($jsxcSignatureHeader === '' || is_null($jsxcSignatureHeader)) {
4141
throw new SecurityException('HTTP header "X-JSXC-Signature" is missing.');
4242
} elseif (! extension_loaded('hash')) {
4343
throw new SecurityException('Missing "hash" extension to check the secret code validity.');

tests/unit/Middleware/ExternalApiMiddlewareTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function testBeforeControllerWithoutHeader()
4949
->expects($this->once())
5050
->method('getHeader')
5151
->with('X-JSXC-SIGNATURE')
52-
->willReturn(null);
52+
->willReturn('');
5353

5454
$this->expectException(SecurityException::class);
5555
$this->expectExceptionMessage('HTTP header "X-JSXC-Signature" is missing.');

0 commit comments

Comments
 (0)