Download & Extend

Path not linked to node id after previewing then saving node

Project:Pathauto
Version:7.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Dave Reid
Status:closed (fixed)

Issue Summary

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)

AttachmentSizeStatusTest resultOperations
pathauto issue.png8.02 KBIgnored: Check issue status.NoneNone

Comments

#1

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

#2

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...

#3

Priority:normal» major

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

#4

I realy could use a sullution?

#5

Assigned to:Anonymous» Dave Reid

Huh, interesting. I can confirm this bug.

#6

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.

#7

Status:active» needs review

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

AttachmentSizeStatusTest resultOperations
955926-preview-node-empty-uri.patch625 bytesIdleFAILED: [[SimpleTest]]: [MySQL] Repository checkout: failed to checkout from [:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal/drupal].View details

#8

Status:needs review» needs work

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

#9

Status:needs work» needs review

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%.

AttachmentSizeStatusTest resultOperations
955926-preview-node-empty-uri.patch4.35 KBIdleFAILED: [[SimpleTest]]: [MySQL] 392 pass(es), 1 fail(s), and 0 exception(es).View details

#10

without the extra hunk of code this time.

AttachmentSizeStatusTest resultOperations
955926-preview-node-empty-uri.patch2.19 KBIdlePASSED: [[SimpleTest]]: [MySQL] 393 pass(es).View details

#11

Looks good. Thanks, Dave.

#12

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.

#13

Status:fixed» closed (fixed)

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

#14

#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.

#15

#16

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.

nobody click here