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

Breaks in Ruby 3.x due to deprecation of URI.escape #49

Open
pkarjala opened this issue Apr 12, 2023 · 2 comments
Open

Breaks in Ruby 3.x due to deprecation of URI.escape #49

pkarjala opened this issue Apr 12, 2023 · 2 comments

Comments

@pkarjala
Copy link

Due to the deprecation of URI.escape (see ruby/uri@61c6a47 and ruby/uri#14), this gem will no longer work in Ruby 3.x based Rails projects.

Fix might be straightforward to replace with CGI.escape instead.

Specific error from a project using growlyflash 0.10.1:

NoMethodError (undefined method `escape' for URI:Module

        response.headers['X-Message'] = URI.escape(growlyhash.to_json)
                                           ^^^^^^^):
@pkarjala
Copy link
Author

Tested replacing URI.escape with CGI.escape which works, but re-encodes spaces as + instead. Which isn't ideal, but at least fixes the underlying issue.

Alternatively, can remove the URI.escape entirely and the response will send fine with no re-encoded content. Not sure if URI.escape is needed or not for security or standardization reasons?

@pkarjala
Copy link
Author

pkarjala commented Jul 4, 2024

Following up with this, replacing URI.escape with ERB::Util.url_encode seems to fix the issue entirely. Will issue pull request on the chance this ever gets updated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant