Feature #40190 » 0001-Stop-appending-the-utf8-checkmark-parameter-to-form-.patch
app/controllers/application_controller.rb | ||
---|---|---|
475 | 475 |
url = params[:back_url] |
476 | 476 |
if url.nil? && referer = request.env['HTTP_REFERER'] |
477 | 477 |
url = CGI.unescape(referer.to_s) |
478 |
# URLs that contains the utf8=[checkmark] parameter added by Rails are |
|
479 |
# parsed as invalid by URI.parse so the redirect to the back URL would |
|
480 |
# not be accepted (ApplicationController#validate_back_url would return |
|
481 |
# false) |
|
482 |
url.gsub!(/(\?|&)utf8=\u2713&?/, '\1') |
|
483 | 478 |
end |
484 | 479 |
url |
485 | 480 |
end |
config/application.rb | ||
---|---|---|
45 | 45 | |
46 | 46 |
config.action_mailer.delivery_job = "ActionMailer::MailDeliveryJob" |
47 | 47 | |
48 |
# Stop appending "utf8=✓" to form URLs |
|
49 |
config.action_view.default_enforce_utf8 = false |
|
50 | ||
48 | 51 |
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. |
49 | 52 |
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. |
50 | 53 |
# config.time_zone = 'Central Time (US & Canada)' |
test/functional/application_controller_test.rb | ||
---|---|---|
1 |
# frozen_string_literal: true |
|
2 | ||
3 |
# Redmine - project management software |
|
4 |
# Copyright (C) 2006-2023 Jean-Philippe Lang |
|
5 |
# |
|
6 |
# This program is free software; you can redistribute it and/or |
|
7 |
# modify it under the terms of the GNU General Public License |
|
8 |
# as published by the Free Software Foundation; either version 2 |
|
9 |
# of the License, or (at your option) any later version. |
|
10 |
# |
|
11 |
# This program is distributed in the hope that it will be useful, |
|
12 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
# GNU General Public License for more details. |
|
15 |
# |
|
16 |
# You should have received a copy of the GNU General Public License |
|
17 |
# along with this program; if not, write to the Free Software |
|
18 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
19 | ||
20 |
require_relative '../test_helper' |
|
21 | ||
22 |
class ApplicationControllerTest < Redmine::ControllerTest |
|
23 |
def test_back_url_should_remove_utf8_checkmark_from_referer |
|
24 |
@request.set_header 'HTTP_REFERER', "/path?utf8=\u2713&foo=bar" |
|
25 |
assert_equal "/path?foo=bar", @controller.back_url |
|
26 |
end |
|
27 |
end |