Skip to content

Commit

Permalink
* lib/uri/ftp.rb (URI::FTP#initialize): raise InvalidURIError if "//"
Browse files Browse the repository at this point in the history
  is not present [ruby-core:47344] [Bug #6945]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36852 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
nurse committed Aug 30, 2012
1 parent ed491f2 commit 37cc18d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions ChangeLog
@@ -1,3 +1,8 @@
Thu Aug 30 09:21:01 2012 NARUSE, Yui <naruse@ruby-lang.org>

* lib/uri/ftp.rb (URI::FTP#initialize): raise InvalidURIError if "//"
is not present [ruby-core:47344] [Bug #6945]

Thu Aug 30 07:45:12 2012 Luis Lavena <luislavena@gmail.com> Thu Aug 30 07:45:12 2012 Luis Lavena <luislavena@gmail.com>


* test/ruby/test_file_exhaustive.rb: fix test introduced in r36811 for * test/ruby/test_file_exhaustive.rb: fix test introduced in r36811 for
Expand Down
1 change: 1 addition & 0 deletions lib/uri/ftp.rb
Expand Up @@ -135,6 +135,7 @@ def self.build(args)
# +opaque+, +query+ and +fragment+, in that order. # +opaque+, +query+ and +fragment+, in that order.
# #
def initialize(*arg) def initialize(*arg)
raise InvalidURIError unless arg[5]
arg[5] = arg[5].sub(/^\//,'').sub(/^%2F/,'/') arg[5] = arg[5].sub(/^\//,'').sub(/^%2F/,'/')
super(*arg) super(*arg)
@typecode = nil @typecode = nil
Expand Down
4 changes: 4 additions & 0 deletions test/uri/test_ftp.rb
Expand Up @@ -27,6 +27,10 @@ def test_parse
assert_equal('pass', url.password) assert_equal('pass', url.password)
end end


def test_parse_invalid
assert_raise(InvalidURIError){URI.parse('ftp:example')}
end

def test_paths def test_paths
# If you think what's below is wrong, please read RubyForge bug 2055, # If you think what's below is wrong, please read RubyForge bug 2055,
# RFC 1738 section 3.2.2, and RFC 2396. # RFC 1738 section 3.2.2, and RFC 2396.
Expand Down

0 comments on commit 37cc18d

Please sign in to comment.