Sometimes, when you use some text (usually the title) to create the path, and the cropped text ends in space, Pathauto transforms that space to the separator, usually a dash "-".
The problem is that many systems and programs don't recognize that "-" at the end of URL and strips it when transforming it in a clickable link, generating an error when any person click on it.
From my experience, the biggest problem in this moment for this issue is with Facebook. When a person share the content by a embedded share button is ok, but if the person copy&paste the URL and share as a status, the FB system does the dash stripping.
Another one that I've found is with Mozilla Thunderbird, when the e-mail comes as simple text and the system turns the URL in the text as clickable.
There must have more cases, so I'm suggesting it as a feature.
Comment | File | Size | Author |
---|---|---|---|
#5 | pathauto-strip_trailing_separators-1549190-5.patch | 802 bytes | emclaughlin |
#3 | pathauto-strip_trailing_separators-1549190-3.patch | 773 bytes | emclaughlin |
Comments
Comment #1
gionnibgud CreditAttribution: gionnibgud commentedYep, I confirm the issue and I agree that it would be a good thing to strip the separator from the end but also from the beginning of the path.
And yes, it is a big issue particularly because of facebook ;)
It also happens at the beginning of the path like path: -something-else.
I'm not sure if it does cause any problem but sure it's ugly.
Comment #2
emclaughlin CreditAttribution: emclaughlin commentedIs this only a problem when there is whitespace at the beginning/end of a URL? Because it seems like it would be a simple enough fix to just make sure to use trim() before generating the alias.
Comment #3
emclaughlin CreditAttribution: emclaughlin commentedIt turned out to be an order of operations issue. The truncating super long URLs was sometimes ending on a "-" instead of on the letter before it. So all that needed to happen was the final clean_separators needed to be after the alias was truncated, not before.
Comment #5
emclaughlin CreditAttribution: emclaughlin commentedOkay, trying this again, with less fail this time, I hope.