diff options
author | francis <francis> | 2008-09-24 18:25:46 +0000 |
---|---|---|
committer | francis <francis> | 2008-09-24 18:25:46 +0000 |
commit | 0946093cda88a2c1411d14bf408c3e578c5285f7 (patch) | |
tree | e213e3b59cc8516b863eb3cb2d73995b6eecda30 /app/helpers/link_to_helper.rb | |
parent | 9236681f1abcf192fc5fa33491b572b526c498fb (diff) |
Work round Rails bug to do with escaping of slashes in path components.
Diffstat (limited to 'app/helpers/link_to_helper.rb')
-rw-r--r-- | app/helpers/link_to_helper.rb | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/app/helpers/link_to_helper.rb b/app/helpers/link_to_helper.rb index 1fa1f9f28..dc61f81cd 100644 --- a/app/helpers/link_to_helper.rb +++ b/app/helpers/link_to_helper.rb @@ -5,7 +5,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: link_to_helper.rb,v 1.40 2008-09-07 16:55:55 francis Exp $ +# $Id: link_to_helper.rb,v 1.41 2008-09-24 18:25:46 francis Exp $ module LinkToHelper @@ -113,6 +113,16 @@ module LinkToHelper # came from the front page and are looking for public bodies def search_url(query, postfix = nil) url = search_general_url(:combined => query) + + # Here we can't escape the slashes, as RFC 2396 doesn't allow slashes + # within a path component. Rails is assuming when generating URLs that + # either there aren't slashes, or we are in a query part where you can + # have escaped slashes. Apache complains if you do include slashes + # within a path component. + # See http://www.webmasterworld.com/apache/3279075.htm + # and see 3.3 of http://www.ietf.org/rfc/rfc2396.txt + url.sub!("%2F", "/") + if !postfix.nil? && !postfix.empty? url = url + "/" + postfix end |