Closed (fixed)
Project:
Trash
Version:
3.1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
26 Feb 2026 at 21:41 UTC
Updated:
9 Apr 2026 at 22:05 UTC
Jump to comment: Most recent
Comments
Comment #4
kurttrowbridgeI'm a little unsure about the correctness of this fix, but will submit it for feedback—see the provided MR.
I think the issue that was causing the incorrect error is the
deletedcondition. It doesn't look likenotExists('deleted')in thevalidateRestoremethod's entity query correctly ignores items in thepath_aliastable that (because they got trashed along with the node they were aliasing) have a timestamp in the value. Changing that to a condition-based query seemed to get around that.Then, I noticed that it caused two instances of the same alias to be restored: the original one got its
deletedvalue removed, and a new one was created because Pathauto'shook_entity_update()got fired before the alias was restored (if I'm following correctly, when the node was restored, the new alias was generated). Moving the alias restoration into thepreTrashRestore()method allowed me to restore a node, have its alias restored along with it, and not get any duplication. (I wonder whetherpostTrashRestore()still needs to keep the alias restoration too, but I left it there for now.Thanks!
Comment #7
amateescu commented@kurttrowbridge, thanks for looking into it! The problem is that Pathauto is creating duplicate aliases when restoring content, so I opened a new MR with a more comprehensive fix.
Btw, the
notExists('deleted')condition is correct because the deleted field can be either NULL or a (recent) timestamp, but never 0 :)Comment #11
amateescu commentedMerged!
Comment #13
kurttrowbridgeAhh, yeah, your MR makes much more sense and clears up what was really happening. :) Thanks!