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
fixes #268 Addressable::URI.heuristic_parse: uri starts with a digit … #296
Conversation
spec/addressable/uri_spec.rb
Outdated
@@ -6252,6 +6252,18 @@ def to_str | |||
end | |||
end | |||
|
|||
describe Addressable::URI, "when given the input " + | |||
"'7777.example.org:8089'" do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Layout/MultilineOperationIndentation: Align the operands of an expression spanning multiple lines.
spec/addressable/uri_spec.rb
Outdated
@@ -6252,6 +6252,18 @@ def to_str | |||
end | |||
end | |||
|
|||
describe Addressable::URI, "when given the input " + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/LineEndConcatenation: Use \ instead of + or << to concatenate those strings.
spec/addressable/uri_spec.rb
Outdated
@@ -6252,6 +6252,17 @@ def to_str | |||
end | |||
end | |||
|
|||
describe Addressable::URI, "when given the input which start with digits and has specified port" do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Metrics/LineLength: Line is too long. [99/80]
@@ -5498,7 +5498,7 @@ def to_s | |||
expect(uri.tld).to eq("uk") | |||
end | |||
|
|||
context "witch " do | |||
context "which " do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
preamble: #294 (review)
Closes #275 |
spec/spec_helper.rb
Outdated
@@ -18,4 +18,5 @@ | |||
|
|||
RSpec.configure do |config| | |||
config.warnings = true | |||
config.filter_run_when_matching :focus |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI this require rspec core >= 3.5
https://relishapp.com/rspec/rspec-core/v/3-5/docs/filtering/filter-run-when-matching (switch version to 3.4 and docs can't be found)
the Gemfile here says rspec 3.0:
Line 6 in b919fb0
gem 'rspec', '~> 3.0' |
I think that should be bumped if this goes in
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dentarg you know better what is better for this repo
Tell me to change the version of the gem or delete this line?
I will do as you say, thank you
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might be better to remove this line and submit it as a suggestion in another pull request, with the bump in Gemfile
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay, i'll do it later, thank you
lib/addressable/uri.rb
Outdated
@@ -194,6 +194,8 @@ def self.heuristic_parse(uri, hints={}) | |||
uri.sub!(/^file:\/+/i, "file:///") | |||
when /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/ | |||
uri.sub!(/^/, hints[:scheme] + "://") | |||
else | |||
uri = hints[:scheme] + "://" + uri if uri[/\A\d+\..*:\d+\z/] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just make this another when clause?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure, it's much better, thank you
…th a digit and has specified port
…and has specified port