When using [termpath] and [termpath-raw] tokens in other modules for instance the upload module I am getting double slashes in the path right before the last category name in the tree.

For example:
When using [termpath] and [termpath-raw] along with the uploadpath module I am getting paths like the following when uploading files:

I have attached a patch that fixes the issue. I'm just not sure if its the best way to go about it.

CommentFileSizeAuthor
pathauto-slash-fix.patch1 KBchey

Comments

chey’s picture

When i said "I am getting paths like the following when uploading files:" I meant to put this after it.

/sites/default/files/document2/Root-Level/Under-Root-Level/Under-Under-Root-Level//Deepest-Level/SAW_Inventory_Capacity_Management.doc

note the extra slash between Under-Under-Root-Level and Deepest

deciphered’s picture

I can second this issue with FileField Paths.

MGN’s picture

There is already a patch on the queue (#376417: When catpath* are empty, don't add a slash submitted back in February), that might also apply to this issue. Can you try that patch out and see if it works (its been so long since I fixed this problem I am not sure I remember how to recreate it!). Since these two proposed patches both attempt to fix the same two lines of code, it would be best if we could propose one patch that fixed it all.

Also generally its best if you could roll your patch against the latest dev version, just to make sure it hasn't already been fixed. The latest dev was released about a month ago, whereas 1.1 was released a year ago...

Thanks!

EDIT:

Nevermind. I just tried #376417: When catpath* are empty, don't add a slash with the latest dev and discovered that it doesn't work with child terms.

MGN’s picture

Status: Active » Reviewed & tested by the community

I have tested this patch against the latest dev with nodes that have no terms, single terms and terms with one or more parents and it works in all cases. Its a logical, straightforward solution to this issue, as well as #376417: When catpath* are empty, don't add a slash.

greggles’s picture

Status: Reviewed & tested by the community » Fixed

Committed to 6.x-1.x and 6.x-2.x http://drupal.org/cvs?commit=326946 http://drupal.org/cvs?commit=326948

Thanks chey and MGN!

In my testing it appears that this is not necessary for 7.x, but if you feel it is please let me know.

Status: Fixed » Closed (fixed)

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