##// END OF EJS Templates
Removes the UTF8 checkmark that prevents redirect from back_url....
Jean-Philippe Lang -
r15153:3be218568347
parent child
Show More
@@ -1109,6 +1109,11 module ApplicationHelper
1109 url = params[:back_url]
1109 url = params[:back_url]
1110 if url.nil? && referer = request.env['HTTP_REFERER']
1110 if url.nil? && referer = request.env['HTTP_REFERER']
1111 url = CGI.unescape(referer.to_s)
1111 url = CGI.unescape(referer.to_s)
1112 # URLs that contains the utf8=[checkmark] parameter added by Rails are
1113 # parsed as invalid by URI.parse so the redirect to the back URL would
1114 # not be accepted (ApplicationController#validate_back_url would return
1115 # false)
1116 url.gsub!(/(\?|&)utf8=\u2713&?/, '\1')
1112 end
1117 end
1113 url
1118 url
1114 end
1119 end
@@ -1538,4 +1538,9 RAW
1538 assert_equal "#{ja} #{ja}...", result
1538 assert_equal "#{ja} #{ja}...", result
1539 assert !result.html_safe?
1539 assert !result.html_safe?
1540 end
1540 end
1541
1542 def test_back_url_should_remove_utf8_checkmark_from_referer
1543 stubs(:request).returns(stub(:env => {'HTTP_REFERER' => "/path?utf8=\u2713&foo=bar"}))
1544 assert_equal "/path?foo=bar", back_url
1545 end
1541 end
1546 end
General Comments 0
You need to be logged in to leave comments. Login now