Project

General

Profile

Feature #14410 ยป diff.txt

sam.saffron (Sam Saffron), 01/27/2018 08:27 AM

 
diff --git a/lib/uri/common.rb b/lib/uri/common.rb
index 764f89d810..292708c152 100644
--- a/lib/uri/common.rb
+++ b/lib/uri/common.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
#--
# = uri/common.rb
#
@@ -342,17 +342,17 @@ def self.regexp(schemes = nil)
TBLENCWWWCOMP_ = {} # :nodoc:
256.times do |i|
- TBLENCWWWCOMP_[i.chr] = '%%%02X' % i
+ TBLENCWWWCOMP_[-i.chr] = -('%%%02X' % i)
end
TBLENCWWWCOMP_[' '] = '+'
TBLENCWWWCOMP_.freeze
TBLDECWWWCOMP_ = {} # :nodoc:
256.times do |i|
h, l = i>>4, i&15
- TBLDECWWWCOMP_['%%%X%X' % [h, l]] = i.chr
- TBLDECWWWCOMP_['%%%x%X' % [h, l]] = i.chr
- TBLDECWWWCOMP_['%%%X%x' % [h, l]] = i.chr
- TBLDECWWWCOMP_['%%%x%x' % [h, l]] = i.chr
+ TBLDECWWWCOMP_[-('%%%X%X' % [h, l])] = -i.chr
+ TBLDECWWWCOMP_[-('%%%x%X' % [h, l])] = -i.chr
+ TBLDECWWWCOMP_[-('%%%X%x' % [h, l])] = -i.chr
+ TBLDECWWWCOMP_[-('%%%x%x' % [h, l])] = -i.chr
end
TBLDECWWWCOMP_['+'] = ' '
TBLDECWWWCOMP_.freeze
@@ -468,7 +468,7 @@ def self.decode_www_form(str, enc=Encoding::UTF_8, separator: '&', use__charset_
if isindex
if sep.empty?
val = key
- key = ''
+ key = +''
end
isindex = false
end
@@ -482,7 +482,7 @@ def self.decode_www_form(str, enc=Encoding::UTF_8, separator: '&', use__charset_
if val
val.gsub!(/\+|%\h\h/, TBLDECWWWCOMP_)
else
- val = ''
+ val = +''
end
ary << [key, val]
    (1-1/1)