Skip to content
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

Preview link does not open FE preview #1968

Closed
leofeyer opened this issue Jul 23, 2020 · 8 comments · Fixed by #1972
Closed

Preview link does not open FE preview #1968

leofeyer opened this issue Jul 23, 2020 · 8 comments · Fixed by #1972
Labels
Milestone

Comments

@leofeyer
Copy link
Member

leofeyer commented Jul 23, 2020

Affected version(s)

Contao 4.10

Description

  • Back end home page → Preview → no preview bar (and no preview.php fragment)
  • Site structure → edit page → Preview → preview bar is shown
  • Articles → edit article → Preview → preview bar is shown
  • Members → Preview front end as member → no preview bar

So it seems that the /contao/preview route with anything but ?page= is broken?

@aschempp @richardhj /cc

@leofeyer leofeyer added the bug label Jul 23, 2020
@leofeyer leofeyer added this to the 4.10 milestone Jul 23, 2020
@aschempp
Copy link
Member

I'm pretty sure that's the same behavior in Contao 4.9 😂 Preview is only if you click the preview in the header. Not any other links…

@m-vo
Copy link
Member

m-vo commented Jul 23, 2020

Preview is only if you click the preview in the header.

I can reproduce this by clicking exactly this button.

@m-vo
Copy link
Member

m-vo commented Jul 23, 2020

This happens because the PreviewURLConvertListener won't set the preview URL (because $request->query->has('page') is false) and therefore the BackendPreviewController redirects to /.

Edit: It should probably just return this instead, does it?

return new RedirectResponse($this->previewScript);

@richardhj
Copy link
Member

richardhj commented Jul 23, 2020

In my Contao 4.9, it correctly redirects to /preview.php, which is correct. The BackendPreviewController defaults to redirecting to the contao_root route.
So I guess it broke in 4.10. @aschempp you deprecated the contao_root route, didn't you?

@m-vo
Copy link
Member

m-vo commented Jul 23, 2020

@richardhj
Copy link
Member

In 4.9 the line looked like this:

        return new RedirectResponse($this->router->generate('contao_root', [], UrlGeneratorInterface::ABSOLUTE_URL));

@leofeyer
Copy link
Member Author

IMHO the bigger issue is that the "open frontend as member …" feature is broken. Not sure whether these two are related?

@leofeyer leofeyer linked a pull request Jul 23, 2020 that will close this issue
@leofeyer
Copy link
Member Author

It seems they are: #1972 🎉

leofeyer added a commit that referenced this issue Jul 24, 2020
Description
-----------

| Q                | A
| -----------------| ---
| Fixed issues     | Fixes #1968
| Docs PR or issue | -

Commits
-------

8f44044 Fix the front end preview
0c321e4 Use Request::getBaseUrl()
9e3c402 Reset the tests
3148aee Adjust the test
AlexejKossmann pushed a commit to AlexejKossmann/contao that referenced this issue Apr 6, 2021
Description
-----------

| Q                | A
| -----------------| ---
| Fixed issues     | Fixes contao#1968
| Docs PR or issue | -

Commits
-------

8f44044 Fix the front end preview
0c321e4 Use Request::getBaseUrl()
9e3c402 Reset the tests
3148aee Adjust the test
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants