diff options
author | Holger Hees <holger.hees@gmail.com> | 2020-01-13 17:53:08 +0100 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2020-07-06 21:34:46 +0200 |
commit | e70249e0896c49cd04365dc7bd088dab8bc6d5dd (patch) | |
tree | f3b4b97e3324ab6bc76c0771ee6fda03fd9ef2e8 | |
parent | b2959d7c86e39bd0064f89dab0912c28334d56ab (diff) | |
download | nextcloud-server-e70249e0896c49cd04365dc7bd088dab8bc6d5dd.tar.gz nextcloud-server-e70249e0896c49cd04365dc7bd088dab8bc6d5dd.zip |
Update SecurityMiddleware.php
OC::$WEBROOT can be empty in case if your nextcloud installation has no url prefix. This will result in an empty Location Header.
in other areas OC::$WEBROOT is always used together with an /
-rw-r--r-- | lib/private/AppFramework/Middleware/Security/SecurityMiddleware.php | 2 | ||||
-rw-r--r-- | tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/lib/private/AppFramework/Middleware/Security/SecurityMiddleware.php b/lib/private/AppFramework/Middleware/Security/SecurityMiddleware.php index 5eb1d7f30be..089f3589454 100644 --- a/lib/private/AppFramework/Middleware/Security/SecurityMiddleware.php +++ b/lib/private/AppFramework/Middleware/Security/SecurityMiddleware.php @@ -211,7 +211,7 @@ class SecurityMiddleware extends Middleware { public function afterException($controller, $methodName, \Exception $exception): Response { if ($exception instanceof SecurityException) { if ($exception instanceof StrictCookieMissingException) { - return new RedirectResponse(\OC::$WEBROOT); + return new RedirectResponse(\OC::$WEBROOT . '/'); } if (stripos($this->request->getHeader('Accept'),'html') === false) { $response = new JSONResponse( diff --git a/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php b/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php index 306ee9f841c..69f1aa5d547 100644 --- a/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php +++ b/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php @@ -535,7 +535,7 @@ class SecurityMiddlewareTest extends \Test\TestCase { new StrictCookieMissingException() ); - $expected = new RedirectResponse(\OC::$WEBROOT); + $expected = new RedirectResponse(\OC::$WEBROOT . '/'); $this->assertEquals($expected , $response); } |