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

Error page type with 404 code can’t preview in CMS #904

Open
2 tasks done
pack254 opened this issue Oct 31, 2024 · 2 comments
Open
2 tasks done

Error page type with 404 code can’t preview in CMS #904

pack254 opened this issue Oct 31, 2024 · 2 comments

Comments

@pack254
Copy link

pack254 commented Oct 31, 2024

Module version(s) affected

7.1

Description

I have a SilverStripe\ErrorPage\ErrorPage page type in the project which sets the ErrorCode to 404. When I am in the CMS, to split view to preview the page. it shows the /admin/pages page instead. I have found this caused by LocaleSwitchRedirector.

How to reproduce

  1. Create any two locales
  2. Edit ErrorPage type with 404 code
  3. Preview the page by split view, you will see it display the admin/pages instead of error page template.

Possible Solution

I have temporarily fixed it by using the Injector and added the additional condition for it, !$request->getVar('CMSPreview').

Additional Context

Screenshot 2024-10-31 at 4 37 52 PM

Validations

  • Check that there isn't already an issue that reports the same bug
  • Double check that your reproduction steps work in a fresh installation of silverstripe/installer (with any code examples you've provided)
@tractorcow
Copy link
Collaborator

tractorcow commented Oct 31, 2024

I think that temporary fix is fine as a permanent fix. Do you want to PR the change to add the extra condition?

@pack254
Copy link
Author

pack254 commented Oct 31, 2024

Yep, sure thing! I will raise a PR for this @tractorcow 👍

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

No branches or pull requests

2 participants