Problem/Motivation
When destination query parameter is present redirects point to that page instead of the path:
<page_url>/ce-api/node/add/foo?destination=bar should generate a frontend direct to /node/add/foo?destination=bar not /bar.
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | lupus_ce_renderer-destination_query_parameter-3353656-6.patch | 973 bytes | useernamee |
Issue fork lupus_ce_renderer-3353656
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
useernamee commentedIt looks like this is not realy a lupus_ce_renderer but a designed behavior in
\Drupal\Core\EventSubscriber\RedirectResponseSubscriber::checkRedirectUrlthe destination parameter has precedence and is set as targetUrl on RedirectResponse.Comment #3
fagoThis is a Drupal feature - In general it makes sense, but not when we are doing admin fallback redirects (See https://www.drupal.org/project/lupus_ce_renderer/issues/3272161)
Could we undo/prevent this Drupal logic somehow - only for Drupal admin fallback redirects, but keep the original path as is, with destination parameter?
Comment #5
useernamee commentedI've simply removed destination query parameter from request. I think this won't have any undesirable consequences (in cases where destination query parameter is actually desired). If later will be the case we can make it a bit more complicated and just add a
lupus_ce_renderer_redirectattribute to request and then write a service decorator forRedirectResponseSubscriberthat has another condition before applying the destination query parameter override.For now this solution works:
<base-url>/ce-api/node/add/article?destination=bar => "<base-url>/node/add/article?destination=bar"Comment #6
useernamee commentedComment #7
fagoYep, agreed. Patch looks good. Let's get it tested!
Comment #9
useernamee commentedWorks on our ci environments and no regressions were recorded, Thus merging.