bug: #3591839 Preserve the query string when stripping the language prefix; a...
Fixes two gaps in the language-prefix redirect from #3591585 (closed) (CanvasRouteOptionsEventSubscriber::redirectCanvasToDefaultLanguage()):
- A prefix configured for the default language was never stripped, because the redirect only ran when the current language differed from the default. The editor then received a prefixed path and rendered a gray screen.
- The redirect dropped the query string, and a
destinationparameter (present on/admin/content/pagesEdit links) madeRedirectResponseSubscriberoverride the redirect target, returning the user to the overview.
The redirect now strips whatever prefix is configured for the URL-negotiated language, keeps the query string, and removes destination from the active request so it cannot override the target.
AI Disclosure: did you use AI to create a significant portion of this? Yes, AI was used to help debug and come up with a solution. I reviewed and tested the solution before submitting.
Testing instructions
- Configure URL-prefix language negotiation with a prefix for every language, including the default (e.g. default
nl, prefixesnlanden). - Open the Canvas editor via a link under
/nl/: the editor loads (was: gray screen). - On
/en/admin/content/pages, click Edit on a page: the editor opens (was: redirected back to the overview). - Kernel coverage:
tests/src/Kernel/CanvasLanguageRoutesTest.php.
Closes #3591839