diff options
author | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-04-15 13:41:19 +0000 |
---|---|---|
committer | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-04-15 13:41:19 +0000 |
commit | 8588e7631eeab7fe8b91d2f2f7059144b233ad0d (patch) | |
tree | 596b14257561a5b5d240cd845590607bfaa654bf /lib/uri/ftp.rb | |
parent | 77204d5391043a9026c8078d12d84389dbe525dd (diff) | |
download | ruby-8588e7631eeab7fe8b91d2f2f7059144b233ad0d.tar.gz |
* lib/uri/ftp.rb (URI::FTP#set_path): added to correct handling of
special case where path of ftp is relative. This converts relative
path to absolute one, because external representation of ftp path is
relative and internal representation is absolute. [ruby-core:24077]
* lib/uri/ftp.rb (URI::FTP#initialize): converts absolute to relative.
* lib/uri/generic.rb (URI::Generic#check_path): allow relative path
when scheme is ftp.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27350 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/uri/ftp.rb')
-rw-r--r-- | lib/uri/ftp.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/uri/ftp.rb b/lib/uri/ftp.rb index 1ffd9090a6..4e33dadd33 100644 --- a/lib/uri/ftp.rb +++ b/lib/uri/ftp.rb @@ -118,12 +118,13 @@ module URI # +opaque+, +query+ and +fragment+, in that order. # def initialize(*arg) + arg[5] = arg[5].sub(/^\//,'').sub(/^%2F/,'/') super(*arg) @typecode = nil tmp = @path.index(TYPECODE_PREFIX) if tmp typecode = @path[tmp + TYPECODE_PREFIX.size..-1] - self.set_path(@path[0..tmp - 1]) + @path = @path[0..tmp - 1] if arg[-1] self.typecode = typecode @@ -185,6 +186,11 @@ module URI return @path.sub(/^\//,'').sub(/^%2F/,'/') end + def set_path(v) + super("/" + v.sub(/^\//, "%2F")) + end + protected :set_path + def to_s save_path = nil if @typecode |