Closed (won't fix)
Project:
Drupal core
Version:
6.x-dev
Component:
path.module
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
6 Oct 2006 at 12:52 UTC
Updated:
5 Dec 2007 at 19:19 UTC
Jump to comment: Most recent file
I use pathauto.module and I want to avoid the creation of url aliases for some types of node (for instance the type 'case'). As far as I know the only way to do it is to use the node/[nid] pattern in the settings of pathauto.module
When I submit a new case, I get :
Created new alias node/737 for node/737
and the alias is actually created in the url aliases list!
path.module should not create such useless aliases !
| Comment | File | Size | Author |
|---|---|---|---|
| #16 | useless_path6.patch | 1.97 KB | scor |
| #15 | useless_path5.patch | 2.05 KB | Jaza |
| #12 | useless_path4.patch | 1.28 KB | scor |
| #10 | useless_path3.patch | 1.28 KB | scor |
| #8 | useless_path2.patch | 1.28 KB | scor |
Comments
Comment #1
chx commentedSounds like a plan.
Comment #2
chx commentedI guess it applies to 4.7, too...
Comment #3
dries commentedThis is an form validation issue, IMO, and should be fixed at the form validation level.
Comment #4
wim leersI'll create a patch later today.
Comment #5
scor commentedStill applies in drupal 6. I even noticed that once the useless path has been created, you can't overwrite it by a normal path.
To reproduce this bug:
1. create a node
2. edit it and enter the drupal path in the url path settings (ex node/2)
3. save. you will see the useless alias in the url_alias table
4. edit the node again. the url alias field is empty. enter whatever path you want (ex about) and save
5. the path you entered is not used, and there are now 2 paths for this node in the url_alias table
6. edit the node, the path field is empty again. enter another path, save. it will be added as a third alias in the url_alias table.
...you end up with a useless path and multiple paths for the same node in the url_alias table.
This patch adds:
- a form validation when editing a node
- a condition path_set_alias() to avoid creating an alias if the alias and the path are the same. This is for the modules such as pathauto which might use the path_set_alias function directly.
Comment #6
gábor hojtsyLet's do 'node/'. $node->nid instead of "node/$node->nid".
Comment #7
catchIn which case...
Comment #8
scor commentedno problem.
On a side note, I find 24 of these
"node/$node->nid"in the core.Comment #9
dries commentedIs 'drupal path' the terminology that we are using? If so, it should be 'Drupal path' not 'drupal path'. I remember using 'internal path' elsewhere and 'URL alias' elsewhere.
I don't see why this is critical.
Comment #10
scor commentedyes Dries, 'URL alias' and 'internal path' are more consistent and make more sense.
Comment #11
gregglesThis prevents some rare but potentially confusing bugs.
On admin/build/path we call the two types "Alias | System" at the top of the table. We call the internal ones "system paths" in the help text on that page, and on admin/build/path/add we call them "system paths". A few rounds of grepping the code showed that in the UI we use "system path" to describe this most often. There is a separate issu
So, I'd vote for using "system path" for this.
See also: standardize on system path so we can be totally consistent on the name of this within D6.
Comment #12
scor commentedrerolled with 'system path'
Comment #13
chx commentedRegarding "node/$node->nid" I suspect another PHP misbelief in the works -- that quotes are slower than apostrophes. Not so any longer. I can't remember whether 4.1 or 4.2 made this difference totally negligeble but one of them did.
Comment #14
scor commentedEven though there might have been some optimizations, PHP still needs to go through the whole double quoted expression to find the variables.
Anyways, this is not the question here: let's not move away from the main topic of this issue.
Comment #15
Jaza commentedAs well as on node forms, path-same-as-alias validation should also be happening on the path add/edit admin form. Attached patch adds this. Otherwise, looks good.
Comment #16
scor commentedthanks Jaza. I rerolled the patch against HEAD.
Comment #17
Freso commentedAdding this to "my issues" so that I will hopefully be able to give it some love when I get back to patch testing. :)
Comment #18
dries commentedI don't think this is worth fixing. It is a bug in the calling code.
Comment #19
gregglesFor the record, it's a configuration problem in addition to a calling code problem. The proper way to configure pathauto for this situation is to leave the pattern blank for the node type you don't want aliased and also leave the default blank at which point Pathauto won't try to create these useless aliases.
This is a somewhat reasonable concern, though, so I have added change this to a feature request against pathauto to "don't create aliases that are the same as the src". It shouldn't require much extra code and will prevent bloat of the infamous url_alias table.
See http://drupal.org/node/198138 for the Pathauto issue.