Skip to content

Commit

Permalink
Merge pull request #2066 from nextcloud/fix-redirect-double-encoding
Browse files Browse the repository at this point in the history
do not double encode the redirect url
  • Loading branch information
MorrisJobke authored Nov 29, 2016
2 parents 7780e45 + 0ebffa4 commit d86b29b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ public function afterException($controller, $methodName, \Exception $exception)
$url = $this->urlGenerator->linkToRoute(
'core.login.showLoginForm',
[
'redirect_url' => urlencode($this->request->server['REQUEST_URI']),
'redirect_url' => $this->request->server['REQUEST_URI'],
]
);
$response = new RedirectResponse($url);
Expand Down
2 changes: 1 addition & 1 deletion lib/private/legacy/util.php
Original file line number Diff line number Diff line change
Expand Up @@ -975,7 +975,7 @@ public static function checkLoggedIn() {
header('Location: ' . \OC::$server->getURLGenerator()->linkToRoute(
'core.login.showLoginForm',
[
'redirect_url' => urlencode(\OC::$server->getRequest()->getRequestUri()),
'redirect_url' => \OC::$server->getRequest()->getRequestUri(),
]
)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ public function testAfterExceptionReturnsRedirectForNotLoggedInUser() {
'server' =>
[
'HTTP_ACCEPT' => 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'REQUEST_URI' => 'owncloud/index.php/apps/specialapp'
'REQUEST_URI' => 'nextcloud/index.php/apps/specialapp'
]
],
$this->createMock(ISecureRandom::class),
Expand All @@ -472,10 +472,10 @@ public function testAfterExceptionReturnsRedirectForNotLoggedInUser() {
->with(
'core.login.showLoginForm',
[
'redirect_url' => 'owncloud%2Findex.php%2Fapps%2Fspecialapp',
'redirect_url' => 'nextcloud/index.php/apps/specialapp',
]
)
->will($this->returnValue('http://localhost/index.php/login?redirect_url=owncloud%2Findex.php%2Fapps%2Fspecialapp'));
->will($this->returnValue('http://localhost/nextcloud/index.php/login?redirect_url=nextcloud/index.php/apps/specialapp'));
$this->logger
->expects($this->once())
->method('debug')
Expand All @@ -485,7 +485,7 @@ public function testAfterExceptionReturnsRedirectForNotLoggedInUser() {
'test',
new NotLoggedInException()
);
$expected = new RedirectResponse('http://localhost/index.php/login?redirect_url=owncloud%2Findex.php%2Fapps%2Fspecialapp');
$expected = new RedirectResponse('http://localhost/nextcloud/index.php/login?redirect_url=nextcloud/index.php/apps/specialapp');
$this->assertEquals($expected , $response);
}

Expand All @@ -494,7 +494,7 @@ public function testAfterExceptionRedirectsToWebRootAfterStrictCookieFail() {
[
'server' => [
'HTTP_ACCEPT' => 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'REQUEST_URI' => 'owncloud/index.php/apps/specialapp',
'REQUEST_URI' => 'nextcloud/index.php/apps/specialapp',
],
],
$this->createMock(ISecureRandom::class),
Expand Down Expand Up @@ -540,7 +540,7 @@ public function testAfterExceptionReturnsTemplateResponse(SecurityException $exc
'server' =>
[
'HTTP_ACCEPT' => 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'REQUEST_URI' => 'owncloud/index.php/apps/specialapp'
'REQUEST_URI' => 'nextcloud/index.php/apps/specialapp'
]
],
$this->createMock(ISecureRandom::class),
Expand Down

0 comments on commit d86b29b

Please sign in to comment.