Skip to content
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

Normalize errors when trying to run a simple url normalize #513

Closed
ck250186 opened this issue Jun 12, 2023 · 4 comments
Closed

Normalize errors when trying to run a simple url normalize #513

ck250186 opened this issue Jun 12, 2023 · 4 comments

Comments

@ck250186
Copy link

ck250186 commented Jun 12, 2023

Addressable version: 2.8.4
Ruby version: 3.1.4

Code:

 require "addressable/uri"

 url = "https://google.com/cloud/storage"
 addressable_url = Addressable::URI.parse url

 po addressable_url.normalize.to_s

Error

Uncaught exception: Can't convert Object into String.
	/Users/chiragkanase/.rbenv/versions/3.1.4/lib/ruby/gems/3.1.0/gems/addressable-2.8.4/lib/addressable/uri.rb:1636:in `query='
	/Users/chiragkanase/.rbenv/versions/3.1.4/lib/ruby/gems/3.1.0/gems/addressable-2.8.4/lib/addressable/uri.rb:851:in `block in initialize'
	/Users/chiragkanase/.rbenv/versions/3.1.4/lib/ruby/gems/3.1.0/gems/addressable-2.8.4/lib/addressable/uri.rb:2392:in `defer_validation'
	/Users/chiragkanase/.rbenv/versions/3.1.4/lib/ruby/gems/3.1.0/gems/addressable-2.8.4/lib/addressable/uri.rb:840:in `initialize'
	/Users/chiragkanase/.rbenv/versions/3.1.4/lib/ruby/gems/3.1.0/gems/addressable-2.8.4/lib/addressable/uri.rb:2168:in `new'
	/Users/chiragkanase/.rbenv/versions/3.1.4/lib/ruby/gems/3.1.0/gems/addressable-2.8.4/lib/addressable/uri.rb:2168:in `normalize'

Is this a known issue?

@ck250186
Copy link
Author

Additionally tested on 2.8.3, 2.8.2. Same error on those versions.

Working on 2.8.1 and below

@dentarg
Copy link
Collaborator

dentarg commented Jun 13, 2023

Sounds very much like #506

Are you sure you haven't loaded other gems when you get the error?

@ck250186
Copy link
Author

Yes looks like the exact same issue. Looking at the call stack

Screenshot 2023-06-13 at 10 15 54 AM

Do you have any recommendations for other libraries we maybe able to use instead of postrank-uri? The only two methods we need from Postrank are URI.clean and URI.escape

@dentarg
Copy link
Collaborator

dentarg commented Jun 13, 2023

No, never used postrank-uri so I don't know what they. Good thing it is open source so you can easily address this yourself :-) (fork postrank-uri, use your own implementations, etc. ...)

@dentarg dentarg closed this as completed Jun 13, 2023
vasconsaurus added a commit to meedan/pender that referenced this issue Jul 18, 2023
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
vasconsaurus added a commit to meedan/pender that referenced this issue Jul 19, 2023
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants