From 52363d958673ade198aee831860da74d1f24ff9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Luis=20Leal=20Cardoso=20Junior?= Date: Sat, 6 Feb 2021 18:39:50 -0300 Subject: [PATCH] Removing monkeypatched `URI#unescape` since main branch follows ruby 2.7 --- actionpack/lib/action_controller.rb | 1 - .../lib/action_dispatch/routing/redirection.rb | 1 - activesupport/lib/active_support/core_ext/uri.rb | 14 -------------- 3 files changed, 16 deletions(-) diff --git a/actionpack/lib/action_controller.rb b/actionpack/lib/action_controller.rb index a18bb47134..bc184acb99 100644 --- a/actionpack/lib/action_controller.rb +++ b/actionpack/lib/action_controller.rb @@ -65,5 +65,4 @@ require "active_support/core_ext/module/attribute_accessors" require "active_support/core_ext/load_error" require "active_support/core_ext/module/attr_internal" require "active_support/core_ext/name_error" -require "active_support/core_ext/uri" require "active_support/inflector" diff --git a/actionpack/lib/action_dispatch/routing/redirection.rb b/actionpack/lib/action_dispatch/routing/redirection.rb index 0741c7038d..75743eef0e 100644 --- a/actionpack/lib/action_dispatch/routing/redirection.rb +++ b/actionpack/lib/action_dispatch/routing/redirection.rb @@ -1,7 +1,6 @@ # frozen_string_literal: true require "action_dispatch/http/request" -require "active_support/core_ext/uri" require "active_support/core_ext/array/extract_options" require "rack/utils" require "action_controller/metal/exceptions" diff --git a/activesupport/lib/active_support/core_ext/uri.rb b/activesupport/lib/active_support/core_ext/uri.rb index fd5b0b31cc..89bdaa5c44 100644 --- a/activesupport/lib/active_support/core_ext/uri.rb +++ b/activesupport/lib/active_support/core_ext/uri.rb @@ -2,20 +2,6 @@ require "uri" -if RUBY_VERSION < "2.6.0" - require "active_support/core_ext/module/redefine_method" - URI::Parser.class_eval do - silence_redefinition_of_method :unescape - def unescape(str, escaped = /%[a-fA-F\d]{2}/) - # TODO: Are we actually sure that ASCII == UTF-8? - # YK: My initial experiments say yes, but let's be sure please - enc = str.encoding - enc = Encoding::UTF_8 if enc == Encoding::US_ASCII - str.dup.force_encoding(Encoding::ASCII_8BIT).gsub(escaped) { |match| [match[1, 2].hex].pack("C") }.force_encoding(enc) - end - end -end - module URI class << self def parser