Skip to content

Commit

Permalink
temp fix for trailing slash on redirects
Browse files Browse the repository at this point in the history
Issue in SilverStripe Framework 5.1.12 will add a trailing slash to the redirect URL
see: silverstripe/silverstripe-framework#11151
  • Loading branch information
johannesx75 committed Mar 11, 2024
1 parent 942d504 commit 445ce83
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/Control/Controller.php
Expand Up @@ -128,6 +128,22 @@ public function authenticate(HTTPRequest $request)
return $this->redirect($url);
}

/**
* Issue in SilverStripe Framework 5.1.12 will add a trailing slash to the redirect URL
* see: https://github.com/silverstripe/silverstripe-framework/issues/11151
* This method is a workaround for this issue
*
* @param string $url
* @param int $code
* @return HTTPResponse
*/
public function redirect(string $url, int $code = 302): HTTPResponse
{
$response = new HTTPResponse();
return $response->redirect($url, $code);
}


/**
* The return endpoint after the user has authenticated with a provider
*
Expand Down

0 comments on commit 445ce83

Please sign in to comment.