I have a redirect with spaces in the path and the redirect changes %20 to %2520 after saving. It then displays the path in the URL redirects page with the %2520. Hovering over the link shows it with %20. Clicking gives a page with %2520, which does not exist.

CommentFileSizeAuthor
#6 path_redirect_awmckinley.patch762 bytesawmckinley
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rlhawk1’s picture

I'm having this same problem.

nicholasThompson’s picture

Status: Active » Postponed (maintainer needs more info)

I'll check my module - but I cant see where the %20 would come in.

The src should be something like "node/123". The dst (the alias) is your own (or pathauto's) doing. Are you sure this is a GlobalRedirect issue and not a Path Redirect issue?

geerlingguy’s picture

Status: Postponed (maintainer needs more info) » Active

The problem seems to occur when you try to redirect to a file on your server with a space in the name (thus a %20). It might be related to Global Redirect, but I'd say probably not, since GR doesn't take over any paths with the %20 in the URL normally.

This is causing one of my redirects to not quite work correctly; I can do a manual fix for it right now, but it would be best if the %20 could be preserved.

geerlingguy’s picture

Project: Global Redirect » Path redirect
Version: 6.x-1.2 » 6.x-1.0-beta6

Moving to the proper project...

Dave Reid’s picture

Status: Active » Postponed (maintainer needs more info)

Information about the actual redirect would be great. :)

awmckinley’s picture

FileSize
762 bytes

I'm having the same problem. (Using 1.0-beta6)

It looks as if the reason is that I'm trying to create a redirect to what _looks_ like an internal Drupal path:

sites/franwell.com/files/downloads/public/rfid Sleeve Brochure.pdf

path_redirect is giving me: "The redirect to path does not appear valid."

Now if I set the redirect to http://www.franwell.com/sites/franwell.com/files/downloads/public/rfid Sleeve Brochure.pdf it works fine. However, I would prefer to use the internal path because that would make things look a little better as we work with multiple domains.

What appears to happen is that sites/franwell.com/files/downloads/public/rfid Sleeve Brochure.pdf won't take because path_redirect_validate_redirect_field is running the To: field through Drupal's valid_url function, and it looks as if it won't accept the spaces for an internal Drupal path.

My work around has been to set it to

sites/franwell.com/files/downloads/public/rfid%20Sleeve%20Brochure.pdf

instead.

That gives a problem when you try to click on the redirected path because I'm redirected to

sites/franwell.com/files/downloads/public/rfid%2520Sleeve%2520Brochure.pdf

which is not what I intended.

I've attached a patch that decodes the returned redirect before passing it to url(), and that seems to have fixed my problem. I'm assuming it would be harmless to pass the returned URLs through rawurldecode every time because the documentation says it only decodes '%FF' into whatever the character is, and % is only supposed to be used for such things anyways.

Hope that helps!

Dave Reid’s picture

Status: Postponed (maintainer needs more info) » Active
Dave Reid’s picture

Status: Active » Fixed

The valid_url() check has been disabled in the latest code. Save your redirect with the raw spaces in and it works just fine.

geerlingguy’s picture

Thanks!

Status: Fixed » Closed (fixed)

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

RowboTony’s picture

Issue summary: View changes

I am having this problem with PDFs also. This discussion was one of the top search engine results. Here is a closely related issue for Drupal 7.x - #1451868: Add Redirect form breaks URLs containing spaces or %20

lavicaa’s picture

Dave Reid "The valid_url() check has been disabled in the latest code. Save your redirect with the raw spaces in and it works just fine."
Thanks! :)