summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-09-12 16:18:03 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-09-12 16:18:03 +0000
commit2e31a202202f8dc8ac16c717e6e578870ebd7f35 (patch)
treebfa0734c7d1d50668866c93c942bb96e66f0daea /lib
parente8bb8fa4f6afd6241f7b5f8a6a66fc6f28e9131c (diff)
downloadruby-2e31a202202f8dc8ac16c717e6e578870ebd7f35.tar.gz
ruby-2e31a202202f8dc8ac16c717e6e578870ebd7f35.tar.xz
ruby-2e31a202202f8dc8ac16c717e6e578870ebd7f35.zip
* lib/open-uri.rb (URI::FTP#buffer_open): fix the %2F handling.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@24875 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/open-uri.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/open-uri.rb b/lib/open-uri.rb
index 4daec25c0..b426455e2 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") }
}