Closed (fixed)
Project:
Token
Version:
5.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
26 May 2007 at 22:07 UTC
Updated:
13 Nov 2007 at 15:32 UTC
Jump to comment: Most recent file
When using [menupath] as token, a dash (-) is inserted where it should have been a slash (/).
At line 58 in token_node.inc, $values['menupath'] is assigned a string with the menu path. The string contains spaces and other characters that are replaced by a dash (-) at line 562 in pathauto.module. Unfortunately, this last call also replaces the slashes (/) inserted in between the menu trail elements at line 58 in token_node.inc. Hence, instead of a/b/c the path becomes a-b-c.
Furthermore, the path is prefixed with the name of the menu.
This was tested on Pathauto 5.x-2.x-dev and Token 5.x-1.x-dev installed on a fresh Drupal 5.1.
| Comment | File | Size | Author |
|---|---|---|---|
| #12 | token_6.patch | 3.14 KB | litwol |
| #11 | token_4.patch | 3.1 KB | litwol |
| #4 | token_menupath_notoplevel_0.patch | 539 bytes | TBarregren |
| #2 | token_menupath_notoplevel.patch | 774 bytes | greggles |
Comments
Comment #1
gregglesI believe the / vs. - problem is fixed in the current version - can you try again.
The problem with the top level menu showing up at the root is still true, though I'm not sure whether that's a problem or not.
Can you explain further what you feel the proper behavior should be on that and why?
Thanks for your patience!
Comment #2
gregglesThe menupath token description says "The menu path (as reflected in the breadcrumb), not including Home or [menu]. Separated by /."
As long as that's the case, it shouldn't include the top level item. Since we already have the [menu] token, anyone who needs it to include the menu can just use [menu][menupath] which should be fine.
Attached patch builds up the $trail only as long as the parent is not the top level (name) of the menu.
Comment #3
TBarregren commentedSorry, but both problems remain. :-(
I have tested the latest version (i.e. 2007-Aug-15) of Token 5.x-1.x-dev and applied the patch and also the latest version (i.e. 2007-Aug-15) of Pathauto 5.x-2.x-dev. When using
[menupath]in Pathauto I don't getabc/def/ghias expected butprimary-links-abc-def-ghi. Thus, both problems remain: instead of/I get-and the path is prefixed with the name of the menu.This bug makes the
[menupath]-token to not work as expected at all. Perhaps that is enough to qualify the bug as critical?BTW, I appreciate very much all work with Token and Pathauto. They are both awesome , and should really be in core IMHO. Thanks!
Comment #4
TBarregren commentedAfter correcting a typo in the patch everything works as expected.
When I took a closer look at your patch I found that a
&&was missing:I include an updated patch.
Comment #5
gregglesquite right you are, sir!
Thanks kindly. Committed to the 5.x-1.x branch. Now it's up to eaton.
Comment #6
AdrianB commentedI had both problems ([menu] in [menupath] and dash instead of slash) with Pathauto 5.x-2.0-beta2 and Token 5.x-1.8. Switching to Pathauto 5.x-2.x-dev (2007-Aug-26) and Token 5.x-1.x-dev (2007-Aug-24) fixed the [menu] problem, but not the dash problem.
After reading this issue it seems like maybe the fix for the dash problem is not commited, right? If I'm not ready to try patches, should I downgrade to Pathauto 5.x-1.2?
Comment #7
AdrianB commentedI downgraded to Pathauto 5.x-1.2 to get the desired behaviour.
(I know the reason is to quickly attract testers but I disagree about having Pathauto 5.x-2.0-beta2 as the recommended version since there's to many oddities.)
Comment #8
susez commentedI have tested pathauto 1.2, 2.x-dev, and 2.0-beta2, but the dash problem remains. I'm not sure if it is a pathauto or token bug. Any fix?
Comment #9
gregglesUpgrade token to 5.x-1.x-dev and it should be fixed.
Thanks.
Comment #10
susez commentedI am using pathauto-5.x-2.x-dev and token-5.x-1.x-dev and the dash is still inserted where it should be a slash.
Comment #11
litwol commentedFriends, i hope my patch will solve this issue once and for all :)
the patch includes a lot of changes mostly due to deleting useless whitespace (my IDE does that automaticaly)
the actual change was very little.
i hope this will receive quick review and if it wasnt my code i would have RTBCed it already ;)
Comment #12
litwol commentedI've uplaoded the wrong patch, here's the correct one.
Comment #13
litwol commentedWhat i've done is just reverse the order of lines 62 and 63.
Comment #14
greggles@litwol - your patch is against the 1.8 version of token and therefore will not apply properly to the head of development. Can you please test (and create patches against) the end of the DRUPAL-5 branch?
Comment #15
litwol commented@greggles,
I have just checked out the HEAD and in there it seems to be already fixed in the same way my patch proposed the solution
on this regard i advise this issue to be labeled as fixed/closed.
Comment #16
gregglesI agree that it should be "closed" but I'm waiting for it to be applied to the 6.x branch.
@litwol - Thanks for your investigation and input.
Comment #17
tormu commented[catpath] doesn't put slashes as the separator either, just dashes :O
Hope this could be fixed with the same patch.
Comment #18
tormu commentedI read through all the comments and got the impression that the problem given in the old title was fixed, but the other problem, which I changed the title for, is not.
I have [catpath] as the pattern for the nodes type "page".
I have a vocabulary with a parent term "test" and child term "testing", and a test article is assigned to this child term.
So I should be getting
test/testingas the path, but gettingtest-testingUsing the newest 5.x dev versions of both Pathauto and Token.
PS. [catpath] seems to be called [termpath] these days in Pathauto..
Comment #19
tormu commentedJust changed the status as I don't have a patch to provide.
Comment #20
dmitrig01 commentedPlease open another issue.
Comment #21
gregglesPorted in eaton's work this past weekend.
Comment #22
(not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.