Sha256: 39017c2720d978c4caf681bf4fa0d733dd1ce5d3bbf1df0b1a6eb07c104afbe9

Contents?: true

Size: 699 Bytes

Versions: 51

Compression:

Stored size: 699 Bytes

Contents

# frozen_string_literal: true

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
      @parser ||= URI::Parser.new
    end
  end
end

Version data entries

51 entries across 49 versions & 7 rubygems

Version Path
grape-extra_validators-2.0.0 vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.2/lib/active_support/core_ext/uri.rb
activesupport-6.0.3.3 lib/active_support/core_ext/uri.rb
activesupport-6.0.3.2 lib/active_support/core_ext/uri.rb
activesupport-6.0.3.1 lib/active_support/core_ext/uri.rb
activesupport-6.0.3 lib/active_support/core_ext/uri.rb
activesupport-6.0.3.rc1 lib/active_support/core_ext/uri.rb
activesupport-6.0.2.2 lib/active_support/core_ext/uri.rb
argon-1.3.1 vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.2.1/lib/active_support/core_ext/uri.rb
symbolic_enum-1.1.5 vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.2.1/lib/active_support/core_ext/uri.rb
activesupport-6.0.2.1 lib/active_support/core_ext/uri.rb
activesupport-6.0.2 lib/active_support/core_ext/uri.rb
activesupport-6.0.2.rc2 lib/active_support/core_ext/uri.rb
zuora_connect_ui-0.10.0 vendor/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/uri.rb
zuora_connect_ui-0.10.0 vendor/ruby/2.6.0/gems/activesupport-6.0.0/lib/active_support/core_ext/uri.rb
activesupport-6.0.2.rc1 lib/active_support/core_ext/uri.rb
zuora_connect_ui-0.9.2 vendor/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/uri.rb
zuora_connect_ui-0.9.2 vendor/ruby/2.6.0/gems/activesupport-6.0.0/lib/active_support/core_ext/uri.rb
activesupport-6.0.1 lib/active_support/core_ext/uri.rb
chatops-rpc-0.0.2 fixtures/chatops-controller-example/vendor/bundle/ruby/2.5.0/gems/activesupport-6.0.0/lib/active_support/core_ext/uri.rb
activesupport-6.0.1.rc1 lib/active_support/core_ext/uri.rb