I've encountered a following problem - Pathauto removes all characters from username which contained punctuation characters only.

E.g. the user registers with username "..---" (a weird username, I know - but anyways). Pathauto is set up so that all punctuation chars are replaces with a separator ("-" in my case). I've assumed that "..---" will be converted into "-----" but it was converted to empty string leading to various issues - like blog feed alias which was "blog/feed" instead of "blog/-----/feed" for that particular user. As a result - the RSS feed for all blog entries was displaying blog entries from "..---" blog only.

I've made some debugging and found out that the problem was with the pathauto_cleanstring function - it trims leading and trailing separator characters thus producing empty string if the original string contained only punctuation characters. I've implemented a simple workaround for this - it is in the attached patch.

Comments

greggles’s picture

Title: pathauto_cleanstring() deletes alias containing punctuation chars only » if the result of cleaning a string is an empty string, insert a separator character
Version: 5.x-2.3 » 7.x-1.x-dev
Status: Active » Needs work

Interesting idea. I've restated it a bit to make it more clear what the patch does. Thanks for contributing it.

We'll want to start with 6.x and move it back, though I imagine the patch applies fairly well across all branches.

dave reid’s picture

Status: Needs work » Closed (duplicate)

Duplicate of #631460: Prevent pathauto_cleanstring() from creating empty components (newer issue has a patch, so that why I'm merging this older issue into the newer issue).