diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-09-12 16:18:03 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-09-12 16:18:03 +0000 |
commit | db2be749b470c28f1feee7d33d5774a3ed6cb36b (patch) | |
tree | bfa0734c7d1d50668866c93c942bb96e66f0daea /lib/open-uri.rb | |
parent | c8f61740086a69ccff5af780c0fd884a15cb35cc (diff) | |
download | ruby-db2be749b470c28f1feee7d33d5774a3ed6cb36b.tar.gz |
* lib/open-uri.rb (URI::FTP#buffer_open): fix the %2F handling.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24875 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/open-uri.rb')
-rw-r--r-- | lib/open-uri.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/open-uri.rb b/lib/open-uri.rb index 4daec25c01..b426455e27 100644 --- a/lib/open-uri.rb +++ b/lib/open-uri.rb @@ -778,8 +778,9 @@ module URI end require 'net/ftp' - directories = self.path.split(%r{/}, -1) - directories.shift if directories[0] == '' # strip a field before leading slash + path = self.path + path = path.sub(%r{\A/}, '%2F') # re-encode the beginning slash because uri library decodes it. + directories = path.split(%r{/}, -1) directories.each {|d| d.gsub!(/%([0-9A-Fa-f][0-9A-Fa-f])/) { [$1].pack("H2") } } |