Commit c3488529 authored by jplang's avatar jplang

Removes the UTF8 checkmark that prevents redirect from back_url.

git-svn-id: https://svn.redmine.org/redmine/trunk@15535 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent bffaf798
......@@ -1109,6 +1109,11 @@ module ApplicationHelper
url = params[:back_url]
if url.nil? && referer = request.env['HTTP_REFERER']
url = CGI.unescape(referer.to_s)
# URLs that contains the utf8=[checkmark] parameter added by Rails are
# parsed as invalid by URI.parse so the redirect to the back URL would
# not be accepted (ApplicationController#validate_back_url would return
# false)
url.gsub!(/(\?|&)utf8=\u2713&?/, '\1')
end
url
end
......
......@@ -1538,4 +1538,9 @@ RAW
assert_equal "#{ja} #{ja}...", result
assert !result.html_safe?
end
def test_back_url_should_remove_utf8_checkmark_from_referer
stubs(:request).returns(stub(:env => {'HTTP_REFERER' => "/path?utf8=\u2713&foo=bar"}))
assert_equal "/path?foo=bar", back_url
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment