Project

General

Profile

Actions

Bug #10150

closed

Tiny URI.parse error incompatibility

Added by matsuda (Akira Matsuda) over 10 years ago. Updated about 10 years ago.

Status:
Closed
Target version:
ruby -v:
ruby 2.2.0dev (2014-08-19 trunk 47220) [x86_64-darwin13]
[ruby-core:64453]

Description

When giving URI.parse an object that does't respond_to #to_str, Ruby 2.1 raises URI::InvalidURIError, whereas 2.2 raises NoMethodError.
Is this change intentional?

% ruby -v -ruri -e "p URI.parse(1)"
ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-darwin13.0]
.../2.1.2/lib/ruby/2.1.0/uri/common.rb:176:in `split': bad URI(is not URI?): 1 (URI::InvalidURIError)

% ruby -v -ruri -e "p URI.parse(1)"
ruby 2.2.0dev (2014-08-19 trunk 47220) [x86_64-darwin13]
.../2.2.0-dev/lib/ruby/2.2.0/uri/rfc3986_parser.rb:9:in split': undefined method to_str' for 1:Fixnum (NoMethodError)

Actions #1

Updated by Anonymous about 10 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

Applied in changeset r47721.


  • lib/uri/rfc3986_parser.rb: raise URI::InvalidURIError when
    uri doesn't respond to #to_str. [ruby-core:64453] [Bug #10150]

  • test/uri/test_parser.rb: test for above.

Actions

Also available in: Atom PDF

Like0
Like0