Drupal 7 beta2, Pathauto 7.x-1.x-dev (10-26-10), Token 7.x-1.x-dev (10-26-10)

After showing the preview of a node, and then saving it (with Url path settings - Automatic alias checked), the alias is created but it's not linked to the node. Everything appears to be configured correctly, and this is not the first time I've used Pathauto. The pattern I'm using for Article paths is articles/[node:title].

See the attached screenshot - articles/test-pathauto-2 was created by just saving the node and is correctly linked to node/5. articles/test-pathauto-3 was first previewed then saved and is not linked to it's corresponding node (node/6).

(This also happens with Pathauto 7.x-1.x-alpha2 and Token 7.x-1.x-alpha3)

Comments

Sparky Marky’s picture

I have the same issue as this, when a preview is made and then the node saved the alias is saved as
news/<node_id> => node/

If I edit the new content, the automatic alias isn't checked. Checking it and doing a preview/save saves it correctly, but as
news/<node_id>-0 => node/<node_id>
if I haven't deleted the incorrect alias.

Deleting the node doesn't delete the incorrect alias.

Running Drupal 7 Beta 2
Pathauto 7.x-1.0-alpha2
Token 7.x-1.0-alpha3

basicmagic.net’s picture

same issue... same components as noted above

- when previewing a node, and then saving-
url alias is created for the node, but for the system path of: node/ (not node/x as it should, x being node id)

works fine when just saving the node without previewing it...

Taxoman’s picture

Priority: Normal » Major

With the recent D7 release, this needs some attention...

SilentAlarm’s picture

I realy could use a sullution?

dave reid’s picture

Assigned: Unassigned » dave reid

Huh, interesting. I can confirm this bug.

dave reid’s picture

Priority: Major » Normal

Well interesting. It turns out this is still a core bug: #1025870: Previewing a node causes $node->uri['path'] to be set to 'node/' in hook_node_insert() but I think we can work around it in Pathauto for now.

dave reid’s picture

Status: Active » Needs review
StatusFileSize
new625 bytes

Please test the following patch, working on a test for it.

Status: Needs review » Needs work

The last submitted patch, 955926-preview-node-empty-uri.patch, failed testing.

dave reid’s picture

Status: Needs work » Needs review
StatusFileSize
new4.35 KB

And now I have a test to back it up. I've confirmed without the change to pathauto_node_insert() that the test fails, and with the change it passes 100%.

dave reid’s picture

StatusFileSize
new2.19 KB

without the extra hunk of code this time.

mjohnq3’s picture

Looks good. Thanks, Dave.

dave reid’s picture

Status: Needs review » Fixed

Committing #10 to CVS!
http://drupal.org/cvs?commit=480990

Please everyone take a moment to subscribe, re-roll, or help work on #1025870: Previewing a node causes $node->uri['path'] to be set to 'node/' in hook_node_insert() so it can be fixed in core before the 7.1 release.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

james.williams’s picture

#12 - The taxonomy test fails because taxonomy needs hook_field_formatter_prepare_view() to be called, but this won't be called since the $node object is altered *before* it is cloned by this patch. This appears to be quite a deep issue, see #844388: Taxonomy terms disappear from node preview if previewed more than once. I've left a patch & comment (#55) calling for it to be fixed.

lotyrin’s picture

james.williams’s picture

Thanks lotyrin. Sorry for re-opening #844388: Taxonomy terms disappear from node preview if previewed more than once, it does sound like a new 8.x issue to sort out entities without URIs is needed. It looks like the patch in #10 will be the fix for pathauto until D8 then.