Skip to content

Commit

Permalink
Merge pull request #144 from froboy/patch-1
Browse files Browse the repository at this point in the history
fix: Ensure alert redirect respects base_path
  • Loading branch information
podarok authored Jun 10, 2024
2 parents a88489d + 0477256 commit c8bb700
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Plugin/rest/resource/AlertsRestResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,11 @@ public function get() {

if ($language && !$request_language || $request_language && $request_language->getId() != $alert_language) {
// Redirect to the same request URL with the language code added after the basePath.
$redirectUrl = $this->request->getSchemeAndHttpHost() . '/' . $langcode . $this->request->getRequestUri();
$base_path = $this->request->getBasePath();
$redirectUrl = $this->request->getSchemeAndHttpHost()
. $base_path . '/'
. $langcode
. str_replace($base_path, '', $this->request->getRequestUri()) ;
// Sets the HTTP Status code to 303 - See Other.
$response = new ModifiedResourceResponse(NULL, 303);
$response->headers->set('Location', $redirectUrl);
Expand Down

0 comments on commit c8bb700

Please sign in to comment.