From b40a729698c0cb15b1aea3d13115e438d8e8b88e Mon Sep 17 00:00:00 2001 From: Yasuo Honda Date: Thu, 22 Mar 2018 11:46:20 +0000 Subject: Ruby 2.6 will not require monkey patched `URI#unescape` since revision 62897 https://github.com/ruby/ruby/commit/234a30459cdae6aa7da6e28a1082d9c11f315696 --- activesupport/lib/active_support/core_ext/uri.rb | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'activesupport/lib') diff --git a/activesupport/lib/active_support/core_ext/uri.rb b/activesupport/lib/active_support/core_ext/uri.rb index dadabb02e5..02eb3e14d9 100644 --- a/activesupport/lib/active_support/core_ext/uri.rb +++ b/activesupport/lib/active_support/core_ext/uri.rb @@ -2,16 +2,8 @@ require "uri" str = "\xE6\x97\xA5" -parser = URI::Parser.new -needs_monkeypatch = - begin - str + str != parser.unescape(str + parser.escape(str).force_encoding(Encoding::UTF_8)) - rescue Encoding::CompatibilityError - true - end - -if needs_monkeypatch +if RUBY_VERSION < "2.6.0" require "active_support/core_ext/module/redefine_method" URI::Parser.class_eval do silence_redefinition_of_method :unescape -- cgit v1.2.3