New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Correctly add the preview script #4857
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what about all the other places, like PageModell::getPreviewUrl()
?
also, should it ever be possible to set a preview script that includes a subfolder/path? Or maybe we should add a validation for that?
also, this seems to assume the default entry point is never called with a script, or am I reading this wrong?
They were not affected in my tests, probably because we are using the UrlGenerator with a custom context there instead of the request object. |
It look like that after this commit, the frontend preview URLs like I think the fix would be: -return new RedirectResponse($request->getBasePath().$this->previewScript.$request->getPathInfo());
+return new RedirectResponse($request->getBasePath().$this->previewScript.$request->getPathInfo().($request->getQueryString() ? ('?' . $request->getQueryString()) : '')); But I am not completely sure. |
Looks correct to me. Would you be so kind to create a PR? I think to show the problem it should be sufficient to add a query to any of the tests ;) |
See #4891 |
If Contao runs in a subfolder (which we allow locally), the
/preview.php
fragment will be added incorrectly.URL:
https://domain.wip/managed-edition/public/contao/preview
Before:
https://domain.wip/preview.php/managed-edition/public/contao/preview
After:
https://domain.wip/managed-edition/public/preview.php/contao/preview