From: Tim Düsterhus Date: Thu, 1 Sep 2022 08:02:58 +0000 (+0200) Subject: Support URIs with query-string in AbstractOauth2Action::getAuthorizeUrl() X-Git-Tag: 5.5.5_dev_1~29^2^2~1 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=6ffbd987a6cbce9934f7c5c62cb9c00f7746f902;p=GitHub%2FWoltLab%2FWCF.git Support URIs with query-string in AbstractOauth2Action::getAuthorizeUrl() --- diff --git a/wcfsetup/install/files/lib/action/AbstractOauth2Action.class.php b/wcfsetup/install/files/lib/action/AbstractOauth2Action.class.php index 427e39b0d4..64baf775b5 100644 --- a/wcfsetup/install/files/lib/action/AbstractOauth2Action.class.php +++ b/wcfsetup/install/files/lib/action/AbstractOauth2Action.class.php @@ -4,6 +4,7 @@ namespace wcf\action; use GuzzleHttp\ClientInterface; use GuzzleHttp\Psr7\Request; +use Laminas\Diactoros\Uri; use ParagonIE\ConstantTime\Base64UrlSafe; use ParagonIE\ConstantTime\Hex; use Psr\Http\Client\ClientExceptionInterface; @@ -225,7 +226,14 @@ abstract class AbstractOauth2Action extends AbstractAction $parameters['code_challenge_method'] = 'S256'; } - $url = $this->getAuthorizeUrl() . '?' . \http_build_query($parameters, '', '&'); + $encodedParameters = \http_build_query($parameters, '', '&'); + + $url = new Uri($this->getAuthorizeUrl()); + if (($query = $url->getQuery())) { + $url = $url->withQuery("{$query}&{$encodedParameters}"); + } else { + $url = $url->withQuery($encodedParameters); + } HeaderUtil::redirect($url);