1
0
mirror of https://github.com/meineerde/redmine.git synced 2026-01-31 03:27:14 +00:00

Removes the UTF8 checkmark that prevents redirect from back_url.

git-svn-id: http://svn.redmine.org/redmine/trunk@15535 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2016-06-15 19:04:36 +00:00
parent f694839c82
commit 3be2185683
2 changed files with 10 additions and 0 deletions

View File

@ -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

View File

@ -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