]> source.dussan.org Git - nextcloud-server.git/commitdiff
Fix absolute redirect 20495/head
authorJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Fri, 10 Apr 2020 06:50:15 +0000 (08:50 +0200)
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>
Wed, 15 Apr 2020 09:30:10 +0000 (09:30 +0000)
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
core/Controller/LoginController.php
tests/Core/Controller/LoginControllerTest.php

index 13aef8f67ab0d8e3537d7dfe5769d1a3d5775aff..6446941ff9c3a51fa9c780ef74c7ad567257ae82 100644 (file)
@@ -253,7 +253,7 @@ class LoginController extends Controller {
 
        private function generateRedirect(?string $redirectUrl): RedirectResponse {
                if ($redirectUrl !== null && $this->userSession->isLoggedIn()) {
-                       $location = $this->urlGenerator->getAbsoluteURL(urldecode($redirectUrl));
+                       $location = $this->urlGenerator->getAbsoluteURL($redirectUrl);
                        // Deny the redirect if the URL contains a @
                        // This prevents unvalidated redirects like ?redirect_url=:user@domain.com
                        if (strpos($location, '@') === false) {
index 6a6795a8e82a27311e5a827bd1baf4b52e3bb1ee..83a30def6b8a60a62ff8368c3e886a9bf12a4db5 100644 (file)
@@ -503,7 +503,7 @@ class LoginControllerTest extends TestCase {
                        ->method('getUID')
                        ->will($this->returnValue('jane'));
                $password = 'secret';
-               $originalUrl = 'another%20url';
+               $originalUrl = 'another url';
                $redirectUrl = 'http://localhost/another url';
 
                $this->request
@@ -545,7 +545,7 @@ class LoginControllerTest extends TestCase {
                        $this->request,
                        $user,
                        $password,
-                       '%2Fapps%2Fmail'
+                       '/apps/mail'
                );
                $loginResult = LoginResult::success($loginData);
                $this->chain->expects($this->once())
@@ -561,7 +561,7 @@ class LoginControllerTest extends TestCase {
                        ->will($this->returnValue($redirectUrl));
                $expected = new \OCP\AppFramework\Http\RedirectResponse($redirectUrl);
 
-               $response = $this->loginController->tryLogin($user, $password, '%2Fapps%2Fmail');
+               $response = $this->loginController->tryLogin($user, $password, '/apps/mail');
 
                $this->assertEquals($expected, $response);
        }