]> source.dussan.org Git - nextcloud-server.git/commitdiff
Update SecurityMiddleware.php 18867/head
authorHolger Hees <holger.hees@gmail.com>
Mon, 13 Jan 2020 16:53:08 +0000 (17:53 +0100)
committerMorris Jobke <hey@morrisjobke.de>
Mon, 6 Jul 2020 19:34:46 +0000 (21:34 +0200)
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 /

lib/private/AppFramework/Middleware/Security/SecurityMiddleware.php
tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php

index 5eb1d7f30bee8ffd3297042bc76896c3935cc64f..089f35894547ecdf17939f9503cbcd359bd9c921 100644 (file)
@@ -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(
index 306ee9f841cdd0dcdf4dccd5f70698de806f7ca3..69f1aa5d5470cbc90d464d668e0e09549aeb8cee 100644 (file)
@@ -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);
        }