From 353ac52d474286e1357c6d50c318035e3a48dbbc Mon Sep 17 00:00:00 2001 From: Marius Balteanu Date: Tue, 13 Feb 2024 23:13:49 +0000 Subject: [PATCH] Stop appending the utf8 checkmark parameter to form URLs (#40190). Patch by Go MAEDA (@maeda). git-svn-id: https://svn.redmine.org/redmine/trunk@22709 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/controllers/application_controller.rb | 5 ---- config/application.rb | 3 +++ .../functional/application_controller_test.rb | 27 ------------------- 3 files changed, 3 insertions(+), 32 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 9bd6b831a..ad16b0e77 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -475,11 +475,6 @@ class ApplicationController < ActionController::Base 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 diff --git a/config/application.rb b/config/application.rb index 069796185..1beeb2db2 100644 --- a/config/application.rb +++ b/config/application.rb @@ -45,6 +45,9 @@ module RedmineApp config.action_mailer.delivery_job = "ActionMailer::MailDeliveryJob" + # Stop appending "utf8=✓" to form URLs + config.action_view.default_enforce_utf8 = false + # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. # config.time_zone = 'Central Time (US & Canada)' diff --git a/test/functional/application_controller_test.rb b/test/functional/application_controller_test.rb index 1ac44e60e..e69de29bb 100644 --- a/test/functional/application_controller_test.rb +++ b/test/functional/application_controller_test.rb @@ -1,27 +0,0 @@ -# frozen_string_literal: true - -# Redmine - project management software -# Copyright (C) 2006-2023 Jean-Philippe Lang -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - -require_relative '../test_helper' - -class ApplicationControllerTest < Redmine::ControllerTest - def test_back_url_should_remove_utf8_checkmark_from_referer - @request.set_header 'HTTP_REFERER', "/path?utf8=\u2713&foo=bar" - assert_equal "/path?foo=bar", @controller.back_url - end -end