To reproduce:
Create a node and give it an alias.
Now edit the node; change the path alias and hit Preview. Now hit save. The old alias won't be removed, and the new one will be added.
This only happens if you Preview the node *after* changing the URL alias. Otherwise the old alias gets changed, as expected.
Note also that if you now edit the node again and change the alias back (but without hitting Preview) you get a Duplicate entry PHP error, which is probably #228792: ERROR: user warning: Duplicate entry IN: site/modules/path/path.module on line 106 or similar.
Originally when I came across this I thought it was a problem with pathauto, but the problem persisted after disabling that module.
Comment | File | Size | Author |
---|---|---|---|
#9 | path_node_preview-543608.patch | 1.25 KB | lyricnz |
#8 | path_node_preview-D6.patch | 1.21 KB | gpk |
#4 | path_node_preview.patch | 1.29 KB | gpk |
#3 | path_node_preview-D6.patch | 1.22 KB | gpk |
#1 | path_node_preview-D6.patch | 1.22 KB | gpk |
Comments
Comment #1
gpk CreditAttribution: gpk commentedThe problem is that in http://api.drupal.org/api/function/path_form_alter/6 the pid form element is populated with the pid corresponding to the path specified in the node form, not the original path from the database.
Patch for D6 attached which seems to do the trick. Same fix should also work for D7 (once updated for DBTNG).
Comment #2
gpk CreditAttribution: gpk commentedComment #3
gpk CreditAttribution: gpk commentedCleaned patch.
Comment #4
gpk CreditAttribution: gpk commentedAnd for 7.x.
Comment #5
moshe weitzman CreditAttribution: moshe weitzman commentedLooks quite right to me. Could do with a review from someone like greggles or chx.
Comment #6
jromine CreditAttribution: jromine commentedSimpletest for this issue submitted at #550258: Test path alias changes after node preview followed by save
Comment #8
gpk CreditAttribution: gpk commentedIt looks as if the new path API in 7.x has fixed this in a very slightly different way (by using the node's nid rather than its alias to find the relevant pid via the new path_load() API function - see http://api.drupal.org/api/function/path_form_alter/7). [this line clarified Jun 9, 2010]
Setting version back to 6.x for consideration.
This patch is the same as #3 but with a typo in a comment corrected.
Comment #9
lyricnz CreditAttribution: lyricnz commentedBug still exists in D6. Patch works, including replacing only the most recent alias when there are multiple. Reroll
Comment #10
gpk CreditAttribution: gpk commentedSince this is just a re-roll and we have a green light can you set status to RTBC? I'd do it but essentially it's my patch...
Comment #11
gpk CreditAttribution: gpk commented#9: path_node_preview-543608.patch queued for re-testing.