From 19791b2460bf7cdf17437d9ebab4d83b60270a3f Mon Sep 17 00:00:00 2001 From: RussellAult Date: Sun, 10 Nov 2019 15:49:57 -0700 Subject: Check getRedirectUri() for queries Resolves Issue #17885 Check getRedirectUri() for queries, and add a '&' instead of a '?' to $redirectUri if it already has them; otherwise, $redirectUri might end up with two '?'. Signed-off-by: RussellAult --- core/Controller/ClientFlowLoginController.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'core/Controller/ClientFlowLoginController.php') diff --git a/core/Controller/ClientFlowLoginController.php b/core/Controller/ClientFlowLoginController.php index bffedf19224..ba594469a7f 100644 --- a/core/Controller/ClientFlowLoginController.php +++ b/core/Controller/ClientFlowLoginController.php @@ -6,6 +6,7 @@ * @author Lukas Reschke * @author Morris Jobke * @author Roeland Jago Douma + * @author Russell Ault * * @license GNU AGPL version 3 or any later version * @@ -337,9 +338,16 @@ class ClientFlowLoginController extends Controller { $accessToken->setTokenId($generatedToken->getId()); $this->accessTokenMapper->insert($accessToken); - $redirectUri = sprintf( - '%s?state=%s&code=%s', - $client->getRedirectUri(), + $redirectUri = $client->getRedirectUri(); + + if (parse_url($redirectUri, PHP_URL_QUERY)) { + $redirectUri .= '&'; + } else { + $redirectUri .= '?'; + } + + $redirectUri .= sprintf( + 'state=%s&code=%s', urlencode($this->session->get('oauth.state')), urlencode($code) ); -- cgit v1.2.3