Closed (fixed)
Project:
Drupal core
Version:
7.x-dev
Component:
path.module
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
16 Oct 2009 at 23:09 UTC
Updated:
21 Nov 2009 at 19:50 UTC
Jump to comment: Most recent file
Comments
Comment #1
peximo commentedIn path_node_insert() we need to control not only if is set $node->path but also if this field is not empty.
Otherwise path.module create always a empty path.
The following pacth fix this problem.
Comment #2
peximo commentedComment #3
sivaji_ganesh_jojodae commented@peximo's patch adds !empty check to
hook_node_insertalone. In my opinion it should be added tohook_node_validateandhook_node_updateas well.hook_node_validateis where the "The path is already in use." error message is generated and thus prevents from node creation.Comment #4
onejam commentedTesting this patch. I still get an error trying to add an article or blog post.
Error: The path is already in use.
Also noticed, when i manually create the url alias, it accepts spaces in the url. Shouldn't it automatically replace the spaces with dashes instead. should this filed as a separate issue?
Comment #5
stborchertThis review is powered by Dreditor.
Don't use
emptybecause in the (rare) case someone wants to add "0" as alias that would fail.Use
$node->path != ''instead.Comment #6
sivaji_ganesh_jojodae commentedoops.. There was a mistake in my previous patch
if (user_access('create url aliases') || user_access('administer url aliases') && !empty($node->path)) {should be
if ((user_access('create url aliases') || user_access('administer url aliases')) && !empty($node->path)) {Attached is a patch which corrects this mistake and replaces empty() with != check.
Comment #7
onejam commentedMaybe, i'm doing something wrong but patch failed:
Comment #9
peximo commentedRerolled
Comment #10
stborchertWorks.
Comment #11
onejam commentedYep, works for me too.
One issue though, when i tried to remove the url alias it wouldn't allow me. i'm able to save but old url alias still remains there. Should it not just default back to the internal url alias (ie, node/2)? I guess this might be a separate issue?
Comment #12
kscheirerpatch works for me.
2 notes:
Code is excuted only when both if statements are TRUE, they should be combined into 1 statement (and this will make the validate function match insert and update).
This needs to have a test attached. I think this issue is critical enough to go in right away even w/o a test, but there should definitely be some follow up.
Comment #13
mr.york commentedThe fix patch is on this page: http://drupal.org/node/332333
Comment #14
sivaji_ganesh_jojodae commentedLooks like it is fixed. I don't see any error message or an empty alias in {url_alias} table.
Comment #16
heather commentedI have just tested a fresh install - and I don't get a break on node creation.
Where/when did this get fixed?
I'd like to make the error highlight in red, as well as some UI text changes.
Anyone know where this issue was fixed?
Shall we close this?