-
Notifications
You must be signed in to change notification settings - Fork 267
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Addressable::URI::InvalidURIError (Hostname not supplied: '')
when using omit
#363
Comments
@noff what version of Addressable are you using? |
|
Just updated to |
@noff what do you expect this to return? This? irb(main):009:0> Addressable::URI.parse("")
=> #<Addressable::URI:0x168 URI:> Tested this myself with a few variants, seems to only trigger with username/password in the URL irb(main):016:0> Addressable::URI.parse("https://foo.com").omit(:scheme)
=> #<Addressable::URI:0x1e0 URI://foo.com>
irb(main):017:0> Addressable::URI.parse("https://foo.com").omit(:scheme, :host)
=> #<Addressable::URI:0x1f4 URI:>
irb(main):018:0> Addressable::URI.parse("https://foo.com").omit(:scheme, :port, :host)
=> #<Addressable::URI:0x208 URI:>
irb(main):019:0> Addressable::URI.parse("https://foo.com").omit(:scheme, :port, :user, :host)
=> #<Addressable::URI:0x21c URI:>
irb(main):020:0> Addressable::URI.parse("https://foo.com").omit(:scheme, :port, :user, :password, :host)
=> #<Addressable::URI:0x230 URI:>
irb(main):021:0> Addressable::URI.parse("https://[email protected]").omit(:scheme, :port, :user, :password, :host)
=> #<Addressable::URI:0x244 URI:>
irb(main):022:0> Addressable::URI.parse("https://foo:[email protected]").omit(:scheme, :port, :user, :password, :host)
Traceback (most recent call last):
7: from /Users/dentarg/.rubies/ruby-2.7.3/bin/irb:23:in `<main>'
6: from /Users/dentarg/.rubies/ruby-2.7.3/bin/irb:23:in `load'
5: from /Users/dentarg/.rubies/ruby-2.7.3/lib/ruby/gems/2.7.0/gems/irb-1.2.6/exe/irb:11:in `<top (required)>'
4: from (irb):22
3: from /Users/dentarg/.gem/ruby/2.7.3/gems/addressable-2.8.0/lib/addressable/uri.rb:2327:in `omit'
2: from /Users/dentarg/.gem/ruby/2.7.3/gems/addressable-2.8.0/lib/addressable/uri.rb:2421:in `defer_validation'
1: from /Users/dentarg/.gem/ruby/2.7.3/gems/addressable-2.8.0/lib/addressable/uri.rb:2483:in `validate'
Addressable::URI::InvalidURIError (Hostname not supplied: '') I wonder if this is a similar bug? (similar error as in #272) irb(main):015:0> Addressable::URI.parse("https://foo.com").omit(:host)
Traceback (most recent call last):
7: from /Users/dentarg/.rubies/ruby-2.7.3/bin/irb:23:in `<main>'
6: from /Users/dentarg/.rubies/ruby-2.7.3/bin/irb:23:in `load'
5: from /Users/dentarg/.rubies/ruby-2.7.3/lib/ruby/gems/2.7.0/gems/irb-1.2.6/exe/irb:11:in `<top (required)>'
4: from (irb):15
3: from /Users/dentarg/.gem/ruby/2.7.3/gems/addressable-2.8.0/lib/addressable/uri.rb:2327:in `omit'
2: from /Users/dentarg/.gem/ruby/2.7.3/gems/addressable-2.8.0/lib/addressable/uri.rb:2421:in `defer_validation'
1: from /Users/dentarg/.gem/ruby/2.7.3/gems/addressable-2.8.0/lib/addressable/uri.rb:2476:in `validate'
Addressable::URI::InvalidURIError (Absolute URI missing hierarchical segment: 'https:') |
Addressable::URI::InvalidURIError (Hostname not supplied: '')
when using omit
@dentarg
|
Hello. Here is an example:
It raises only with
omit
method.When try to parse URL and use an object, everything works great:
The text was updated successfully, but these errors were encountered: