Skip to content

Conversation

kitsunet
Copy link
Member

@kitsunet kitsunet commented Sep 6, 2019

Using the RequestInformationHelper ensures that the baseUri includes the script request path (so any sub directory neos might be in).

Using the RequestInformationHelper ensures that the baseUri includes the script request path (so any sub directory neos might be in).
@@ -107,7 +107,8 @@ protected function buildResponse(ServerRequestInterface $httpRequest, RedirectIn
$location = $redirect->getTargetUriPath();

if (parse_url($location, PHP_URL_SCHEME) === null) {
$location = (string)$httpRequest->getUri()->withQuery('')->withFragment('')->withPath($location);
$baseUriForRequest = (string)RequestInformationHelper::generateBaseUri($httpRequest);
$location = rtrim($baseUriForRequest, '/') . '/' . ltrim($location, '/');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't be better to assure, that the $baseUriForRequest got from that method always has / has not a trailing slash?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, and actually that is the case. It always has a trailing slash

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we be sure that location has (or has not) a leading slash?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

targetUriPath gets a ltrim for slashes in it's constructor.

@Sebobo
Copy link
Member

Sebobo commented Sep 25, 2019

@kitsunet would this also work with the Neos 4.3 compatible 3.x branch? Then you could retarget the PR

@dlubitz
Copy link
Contributor

dlubitz commented Apr 7, 2025

@kitsunet Can we close this? Or is this still relevant?

@dlubitz
Copy link
Contributor

dlubitz commented Jul 7, 2025

@kitsunet Ping

@dlubitz
Copy link
Contributor

dlubitz commented Jul 28, 2025

I'll close this because this might be outdated in meanwhile. Please feel free to re-open if this is still a solution.

@dlubitz dlubitz closed this Jul 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants