We have forums containing Slashes in their taxonomy name.

If pathauto now creates their forum alias, the forums will contain slashes.
I open this as initial support request since i'm not sure what will be the right approach to remove them... e.g. if we need some additional token or what to do "by design".
Present alias is: [vocab-raw]/[catpath-raw]

I think a valueable default should remove the slashes from the path.

Thanks for your help

Comments

miro_dietiker’s picture

StatusFileSize
new1.4 KB

I actually don't understand why my forum results in this result.
Issue of this seems to be [catpath-raw]
In pathauto.module around 133 i can see that slashes are getting removed for parentising.
But for the current level no slashes are being removed. So we might change the last level to:

            $values[$label .'path'] = $catpath .'/'. check_plain(str_replace('/', '', $category->name));
            $values[$label .'path-raw'] = $catpath_raw .'/'. str_replace('/', '', $category->name);

Attached patch with str_replace (faster) and added further slash remove for clean "virtual parent" stability.

What do you think?

dave reid’s picture

I'm probably +1 on this and change preg_replace to str_replace since it's much faster. Although part of me thinks that instead of removing slashes and replacing with empty string, it should be replaced by the separator.

dave reid’s picture

Version: 7.x-1.x-dev » 6.x-1.x-dev
Status: Active » Needs review
dave reid’s picture

Component: User interface » Code
Assigned: Unassigned » dave reid
Category: support » task
StatusFileSize
new1.23 KB

Actually the more appropriate thing to do would to use pathauto_cleanstring().

miro_dietiker’s picture

Generally agree since pathauto_cleanstring does also remove slashes by default (second param TRUE)
but if we accept this we can also remove the preg_replace from the previous lines (2 up). since outer pathauto_cleanstring finally removes slashes too.

Finally code for parent terms and for current level should be identical to make it appear straight. Agree?

Well ... separators ... ;-) it's some replacement in any case containing ambiguity.

dave reid’s picture

@mri_dietiker: That's actually already handled in #344786: Unnecessary preg_replace in pathauto_token_values.

dave reid’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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