Download & Extend

Space (%20) characters changed to %2520 in redirect, which do not point anywhere.

Project:Path redirect
Version:6.x-1.0-beta6
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

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.

Comments

#1

I'm having this same problem.

#2

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?

#3

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.

#4

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

Moving to the proper project...

#5

Status:active» postponed (maintainer needs more info)

Information about the actual redirect would be great. :)

#6

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!

AttachmentSizeStatusTest resultOperations
path_redirect_awmckinley.patch762 bytesIgnored: Check issue status.NoneNone

#7

Status:postponed (maintainer needs more info)» active

#8

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.

#9

Thanks!

#10

Status:fixed» closed (fixed)

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