Needs work
Project:
Drupal core
Version:
main
Component:
contextual.module
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
11 Aug 2020 at 02:43 UTC
Updated:
3 Jun 2025 at 22:32 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
shailja179 commentedI am working on this issue.
Comment #3
shailja179 commentedTry with the given patch. It should work now.
Comment #5
tanubansal commentedTested patch #3 on 9.1, its working fine
Able to delete contextual link without 404
Comment #6
abhijith s commentedApplied patch #3 and it works fine. The 'page not found' error is showing after deleting content is gone.
Adding recordings
before patch:

after patch:

Comment #7
abhijith s commentedComment #8
abhijith s commentedComment #9
acbramley commentedPatch is failing to apply and needs tests.
Comment #10
ramya balasubramanian commentedReroll the patch for 9.2.
Comment #12
ramya balasubramanian commentedMoving this to needs review, since that was a random test failure. Again ran the test cases and it was passed.
Comment #13
acbramley commentedStill needs tests...
Comment #14
ramya balasubramanian commentedAdded test. Please have a look and let me know if there are any issues.
Comment #15
psf_ commentedThis patch only will work with
Nodeentities, but we have the problem withGroupentities. Must it be more generic?Comment #16
psf_ commentedThe correct way may be always to send to the base path in 'Delete' links?
Replacing:
With:
Comment #17
acbramley commentedThis test has whitespace and indentation issues. It's also not actually testing the fix at the moment.
The best approach is to upload a test-only patch alongside your patch with the fix AND the test in order to prove that your test is testing the fix correctly.
Comment #18
anmolgoyal74 commentedUpdated CS and indentation issues.
Comment #19
acbramley commentedThis still isn't asserting anything about the bug or fix. It needs to be a javascript test since these changes are in JS.
Comment #20
geek-merlinHmm, hardcoding the 'delete' is a brittle kitten-killer. We might instead look for, say, a "no-destination" query parameter in the link.
Comment #22
mstrelan commentedI don't think it's the right approach to simply change the destination parameter of all contextual links with "node" and "delete" in the URL. It might be better to remove the destination for delete links if the current route matches any of the link templates for the entity in context. The destination parameter should remain if the entity is embedded on another page. It's also worth considering what happens with the cancel button on the confirm form, it points to the destination parameter with a fallback to the entity's canonical route.
An alternative approach would be to leave the destination parameter in place and move this logic to the submit handler of the confirm form. If the destination will result in a 404 due to the entity being deleted then the destination should be removed.
Comment #24
larowlanAgree with what @mstrelan said in #22, those seem like approaches worth exploring
Comment #28
acbramley commentedCame up for triage in BSI, removing all patches and needs tests tag as we need to start from scratch here.