warn users if they use + or " " (space) as separator

guix - February 14, 2008 - 01:15
Project:Pathauto
Version:5.x-2.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:greggles
Status:closed
Description

I chose + for the separator, and in pathauto I have this node pattern : [title-raw]

I submit the node and I'm redirected to /separator%20test so the + has been replaced with a space and urlencoded.

Now the strange part is that I guess this Drupal message : Created new alias separator+test for node/7

However when I go to my homepage for example, where I have published this node, the link for the node is /separator%20test.

I check the aliases in /admin/build/path and indeed they have space as separator instead of +.

And now the final surprise : I manually entered the URL /separator+test... it works ! :-)

#1

mlsamuelson - February 14, 2008 - 06:17

I can confirm this behavior.

And now the final surprise : I manually entered the URL /separator+test... it works ! :-)

By this I believe guix means manually entering the URL into the browser's address bar - NOT manually entering the URL alias at node edit, since that results in the +s being replaced with spaces.

Checking at the db level, if we use +s as the separator, they don't show up in the url_alias table. If we use something like ^ or =, they do show up (but they are url encoded when they show up in the address bar of the browser - though not in the links to the pages).

By the way, I tested in the 5.x-2.0 version, and using + as the separator behaves as one would expect - the +s appear in the address bar and in the links, though not in the database.

mlsamuelson

#2

guix - February 14, 2008 - 06:31

manually entering the URL into the browser's address bar

Yes, that's it !

And the beginning of my issue report should have been of course : I create a node with the title separator test

#3

guix - February 14, 2008 - 06:29
Title:separator + gets is replaced by space but URLs with + still work !» separator + is replaced by space but URLs with + still work !

Changed the title of the issue which was confusing.

#4

greggles - February 14, 2008 - 10:48

By this I believe guix means manually entering the URL into the browser's address bar - NOT manually entering the URL alias at node edit, since that results in the +s being replaced with spaces.

emphasis obviously mine, but if the path module by itself displays the same problem then Pathauto can't do much more...

Here is a prior request about this http://drupal.org/node/140811
Which was fixed in http://drupal.org/node/191116

Basically, it seems that using pluses in the url is a bad idea. I think it might be a good idea to make a note of that somewhere like in the little text underneath the separator box.

#5

guix - February 14, 2008 - 18:14

Thank you Greggles ! Indeed this appears to lie deeper than pathauto. I liked the idea of + as separators but as it's urlencoded to %20 in Drupal Core, and as there's no proven evidence that + is best than - for SEO, I'll just go with the -.

I suggest that more than warning users, pathauto should disallow the use of + as a separator, if there's an easy way to prevent this. It makes sense, as using + as separator doesn't and won't work !

#6

greggles - February 14, 2008 - 18:52
Title:separator + is replaced by space but URLs with + still work !» warn users if they use + or " " (space) as separator
Version:6.x-1.x-dev» 5.x-2.x-dev

Ok - restated the title to fit with the new purpose.

#7

greggles - February 14, 2008 - 20:09
Status:active» patch (reviewed & tested by the community)

I'm not sure I want to do real form validation and block users from the space or +. I think a warning is best so that they can insist on doing it if they want.

AttachmentSize
warn_about_spaces.patch1.12 KB

#8

mlsamuelson - February 15, 2008 - 04:28

The patch worked fine and I like the addition of the wording.

Sounds like the best course of action to me. I didn't think to test/consider the behavior of the path module by itself. Smart.

(Still... working... on... thinking... like... a... computer....)

mlsamuelson

#9

greggles - February 15, 2008 - 10:19
Status:patch (reviewed & tested by the community)» fixed

Awesome - thanks for the review mlsamuelson!

I've now committed this to the branches that become Drupal5.x-2 and 6.x-1.x.

#10

greggles - February 15, 2008 - 10:19
Assigned to:Anonymous» greggles

and that...

#11

Anonymous (not verified) - February 29, 2008 - 10:23
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.