-
Notifications
You must be signed in to change notification settings - Fork 265
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
Any version after 2.8.1 causes errors in our test suite coming from addressable. #506
Comments
Can you post code that reproduce the problem? |
I was able to produce the error in Rails console using this code. # RestClient.version
=> "2.0.2"
RestClient.get("google.com")
TypeError: Can't convert Object into String.
from .gem/ruby/3.1.3/gems/addressable-2.8.4/lib/addressable/uri.rb:1636:in `query=' Can confirm switching [1] pry(main)> RestClient.get("google.com")
=> <RestClient::Response 200 "<!doctype h...">
[2] pry(main)> => <RestClient::Response 200 "<!doctype h..."> |
It seems to be any rails project that has this gem included https://github.com/postrank-labs/postrank-uri |
Please provide code using only Addressable that reproduces the issue, thanks |
@dentarg Not sure I can provide code that uses only Addressable and reproduces the issue, but going from 2.8.1 to 2.8.2 or greater shouldn't introduce breaking changes in gems that depend on addressable right? I would maybe expect breaking changes going from 2.8.x to 2.9, or 2.8 to 3.x, but not 2.8.1 to 2.8.2, as patch versions should be backwards compatible. |
There was no intention to introduce breaking changes in a patch version. This looks like a bug. In order to address the bug we need to know how to reproduce it. Can you or someone else look into what the gems in the Rails repro are doing with addressable that causes this? |
Well after looking into the postrank-uri gem source it looks like it monkey patches the domain and normalized_query methods of the Addressable::URI class. So I'm not sure it actually is a bug in Addressable. |
I was able to play with this a bit little bit myself: Addressable 2.8.2 $ ruby -rbundler/inline -e 'gemfile do; source "https://rubygems.org"; gem "postrank-uri"; gem "addressable", "2.8.2"; end; p Addressable::URI.parse("google.com").normalize'
/Users/dentarg/.arm64_rubies/3.2.2/lib/ruby/gems/3.2.0/gems/addressable-2.8.2/lib/addressable/uri.rb:1636:in `query=': Can't convert Object into String. (TypeError)
raise TypeError, "Can't convert #{new_query.class} into String."
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
from /Users/dentarg/.arm64_rubies/3.2.2/lib/ruby/gems/3.2.0/gems/addressable-2.8.2/lib/addressable/uri.rb:851:in `block in initialize'
from /Users/dentarg/.arm64_rubies/3.2.2/lib/ruby/gems/3.2.0/gems/addressable-2.8.2/lib/addressable/uri.rb:2392:in `defer_validation'
from /Users/dentarg/.arm64_rubies/3.2.2/lib/ruby/gems/3.2.0/gems/addressable-2.8.2/lib/addressable/uri.rb:840:in `initialize'
from /Users/dentarg/.arm64_rubies/3.2.2/lib/ruby/gems/3.2.0/gems/addressable-2.8.2/lib/addressable/uri.rb:2168:in `new'
from /Users/dentarg/.arm64_rubies/3.2.2/lib/ruby/gems/3.2.0/gems/addressable-2.8.2/lib/addressable/uri.rb:2168:in `normalize'
from -e:1:in `<main>' Addressable 2.8.1 $ ruby -rbundler/inline -e 'gemfile do; source "https://rubygems.org"; gem "postrank-uri"; gem "addressable", "2.8.1"; end; p Addressable::URI.parse("google.com").normalize'
#<Addressable::URI:0x3d4 URI:google.com> but yeah, that monkey patch in postrank-uri is super old, soon 12 years, postrank-labs/postrank-uri@110ed0b, and should probably be removed, or at least adjusted, I opened postrank-labs/postrank-uri#49 |
There seems to be a super old monkey patch in postrank that messes with the normalize method, starting at 2.8.2 version. Until postrank fixes that we can only go up to 2.8.1 relevant links: sporkmonger/addressable#513 sporkmonger/addressable#506 postrank-labs/postrank-uri#49
* update rails to 6.1.7.4 while keeping sidekiq under 7 delayed extensions was removed in sidekiq 7 and that breaks things for us https://github.com/sidekiq/sidekiq/blob/main/Changes.md#640 * downgrade addressable to 2.8.1 There seems to be a super old monkey patch in postrank that messes with the normalize method, starting at 2.8.2 version. Until postrank fixes that we can only go up to 2.8.1 relevant links: sporkmonger/addressable#513 sporkmonger/addressable#506 postrank-labs/postrank-uri#49
The change in 2.8.2 that sets the query to NONE seems to be causing issues with postrank-uri gem in our app. Any version of addressable after 2.8.1 and we start seeing these failures.
The text was updated successfully, but these errors were encountered: