mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
URI.unescape fix removes the old unescape method
This commit is contained in:
@@ -1,13 +1,10 @@
|
||||
require 'uri'
|
||||
|
||||
module ActiveSupport
|
||||
if RUBY_VERSION == "1.9.1" && defined?(RUBY_PATCHLEVEL) && RUBY_PATCHLEVEL == 0
|
||||
::URI::Parser.class_eval do
|
||||
def unescape(str, escaped = @regexp[:ESCAPED])
|
||||
enc = (str.encoding == Encoding::US_ASCII) ? Encoding::UTF_8 : str.encoding
|
||||
str.gsub(escaped) { [$&[1, 2].hex].pack('C') }.force_encoding(enc)
|
||||
end
|
||||
if RUBY_VERSION == "1.9.1" && defined?(RUBY_PATCHLEVEL) && RUBY_PATCHLEVEL == 0
|
||||
require 'uri'
|
||||
URI::Parser.class_eval do
|
||||
remove_method :unescape
|
||||
def unescape(str, escaped = @regexp[:ESCAPED])
|
||||
enc = (str.encoding == Encoding::US_ASCII) ? Encoding::UTF_8 : str.encoding
|
||||
str.gsub(escaped) { [$&[1, 2].hex].pack('C') }.force_encoding(enc)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user