diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-05-18 18:58:13 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-05-18 18:58:13 +0000 |
commit | 53fdb30e7f83fcaacb480a1e7c08a9288cd30bd7 (patch) | |
tree | 3c23f9d9334cd077d63b2616d275a5462ab2ffa5 /lib/uri | |
parent | 2849ee5d18360f26b55643a2643a1c597376865d (diff) | |
download | ruby-53fdb30e7f83fcaacb480a1e7c08a9288cd30bd7.tar.gz |
* lib/uri/common.rb (URI.decode_www_form): scrub string if decoded
bytes are invalid for the encoding.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40820 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/uri')
-rw-r--r-- | lib/uri/common.rb | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/lib/uri/common.rb b/lib/uri/common.rb index 5914868e94..1da9f47647 100644 --- a/lib/uri/common.rb +++ b/lib/uri/common.rb @@ -981,17 +981,9 @@ module URI isindex = false end - if use__charset_ - if key == '_charset_' - if e = get_encoding(val) - enc = e - use__charset_ = false - ary.each do |k, v| - v.force_encoding(enc) - k.force_encoding(enc) - end - end - end + if use__charset_ and key == '_charset_' and e = get_encoding(val) + enc = e + use__charset_ = false end key.gsub!(/\+|%\h\h/, TBLDECWWWCOMP_) @@ -1001,10 +993,14 @@ module URI val = '' end - val.force_encoding(enc) - key.force_encoding(enc) ary << [key, val] end + ary.each do |k, v| + k.force_encoding(enc) + k.scrub! + v.force_encoding(enc) + v.scrub! + end ary end |