diff options
author | francis <francis> | 2008-05-21 23:36:52 +0000 |
---|---|---|
committer | francis <francis> | 2008-05-21 23:36:52 +0000 |
commit | 9bab5bbfbee0d17563c930cd9f71babfffcde994 (patch) | |
tree | c401ab9a8caa0c210b234b3fb0c6af2264783824 /app/controllers/application.rb | |
parent | ab1071525a3b74505fc9bf320756b227afeca456 (diff) |
Cope with #s in URLs for post redirects.
Diffstat (limited to 'app/controllers/application.rb')
-rw-r--r-- | app/controllers/application.rb | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/app/controllers/application.rb b/app/controllers/application.rb index fffb32871..7935cc461 100644 --- a/app/controllers/application.rb +++ b/app/controllers/application.rb @@ -6,7 +6,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: application.rb,v 1.46 2008-05-21 10:51:24 francis Exp $ +# $Id: application.rb,v 1.47 2008-05-21 23:36:52 francis Exp $ class ApplicationController < ActionController::Base @@ -92,9 +92,17 @@ class ApplicationController < ActionController::Base # XXX what is the built in Ruby URI munging function that can do this # choice of & vs. ? more elegantly than this dumb if statement? if uri.include?("?") - uri += "&post_redirect=1" + if uri.include?("#") + uri.sub!("#", "&post_redirect=1#") + else + uri += "&post_redirect=1" + end else - uri += "?post_redirect=1" + if uri.include?("#") + uri.sub!("#", "?post_redirect=1#") + else + uri += "?post_redirect=1" + end end redirect_to uri end |