The link alter hook (login_destination_link_alter()) adds the current path to the url for any non-external, non-routed links. For example if you have a link using the base: scheme. It seems as though the altering is only meant to be done on the user.login and user.logout routes but the way the conditional logic is written it will pass through anything that isn't routed or external which actually could be a lot of other things since there can be more unrouted, but internal schemes like base:
Patch incoming!
Comments
Comment #2
drclaw commentedHere's a patch that just applies the current path to the specific user login/logout routes.
Comment #4
megachrizI'm not entirely understanding this issue, but the issue status was set to "Needs work" by the testbot because there were no automated tests yet at the time this patch was posted.
@drclaw
Maybe you want to give some concrete examples that emphasize the difference between expected behavior and actual behavior?
Sounds like this could also use automated tests. Therefore leaving the status to "Needs work".
Comment #5
dabblela commentedRan into this issue as well. Basically, if you are constructing a
'#type' => 'link', but the URL object points to an internal destination that is not a route or an alias of a route, the module will add the "?current=" parameter. For instance, a user entering a path alias for a node into a link field, and then the node/alias getting deleted.Giving a patch with an example test a shot...
Comment #6
dabblela commentedComment #7
dabblela commentedTrying again
Comment #9
dabblela commentedComment #10
dabblela commentedComment #12
dabblela commentedSorry for the patch spam, the failing test looks correct now.
Comment #13
rsvelko commented@dabblela, can you give me a real life example of why do we need that patch? With real life links/urls and example module config.
I can't understand the patch/issue.
I've read the login_destination.module patch and the test case, but I don't get it.
Comment #14
dabblela commented@rsvelko Not sure how to give a link for an environment which shows the issue, but steps to reproduce:
1. Enable login_destination module (module config does not matter)
2. Add a Link field to a content type
3. Create a node with a link in the Link field with a URL that does not resolve to a route. For the purposes of the test, the link should lead to a 404 (eg, "/asdf12341234123afakelink")
4. Save the node and view it - the link will have the
?current=parameterComment #15
rsvelko commentedI get it now. Thanks!
Commiting.
Comment #18
rsvelko commented