From a2c28481a3adb01f44e6c5122c05f06fa4d6bfb7 Mon Sep 17 00:00:00 2001 From: MAEDA Go Date: Sun, 4 Feb 2024 14:55:07 +0900 Subject: [PATCH] Stop appending the utf8 checkmark parameter to form URLs --- app/controllers/application_controller.rb | 5 ---- config/application.rb | 3 +++ .../functional/application_controller_test.rb | 27 ------------------- 3 files changed, 3 insertions(+), 32 deletions(-) delete mode 100644 test/functional/application_controller_test.rb 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 deleted file mode 100644 index 1ac44e60e..000000000 --- a/test/functional/application_controller_test.rb +++ /dev/null @@ -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 -- 2.43.0