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

Use RFC2396_PARSER explicitly to avoid the warning. #2509

Merged
merged 4 commits into from
Jan 20, 2025

Conversation

eGreshkov
Copy link
Contributor

@eGreshkov eGreshkov commented Jan 13, 2025

Description

The URI library recently changed the URI::DEFAULT_PARSER to URI::RFC3986_PARSER.
https://github.com/ruby/uri/blob/master/lib/uri/common.rb#L22

Additionally, when using the URI::RFC3986_PARSER.escape method a warning is logged, telling that the method is obsolete and that URI::RFC2396_PARSER.escape should be used explicitly instead.
https://github.com/ruby/uri/blob/master/lib/uri/rfc3986_parser.rb#L155-L159

This results in a lot of warnings logged to stderr. This simple fix should do the trick :)

@eGreshkov eGreshkov force-pushed the fix-uri-escape-deprecation-warning branch from 4d06152 to 53716e0 Compare January 13, 2025 13:05
Copy link

codecov bot commented Jan 17, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.16%. Comparing base (1cd952b) to head (bf7130d).
Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2509   +/-   ##
=======================================
  Coverage   98.16%   98.16%           
=======================================
  Files         128      128           
  Lines        4848     4849    +1     
=======================================
+ Hits         4759     4760    +1     
  Misses         89       89           
Components Coverage Δ
sentry-ruby 98.54% <100.00%> (+<0.01%) ⬆️
sentry-rails 97.07% <ø> (ø)
sentry-sidekiq 97.09% <ø> (ø)
sentry-resque 92.85% <ø> (ø)
sentry-delayed_job 95.65% <ø> (ø)
sentry-opentelemetry 99.31% <ø> (ø)
Files with missing lines Coverage Δ
sentry-ruby/lib/sentry/net/http.rb 100.00% <100.00%> (ø)

Copy link
Collaborator

@solnic solnic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the PR! Please update to latest master though as we had some issues with the spec suite that should be fixed on master now.

@eGreshkov eGreshkov force-pushed the fix-uri-escape-deprecation-warning branch from 53716e0 to db9bab0 Compare January 20, 2025 08:07
Copy link
Collaborator

@solnic solnic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like in older rubies the constant does not exist:

uninitialized constant URI::RFC2396_PARSER

This is from 2.5 tests. There are more failing test suites with this error unfortunately, so we gotta have a fallback mechanism to make this work for old rubies too.

@eGreshkov
Copy link
Contributor Author

Thanks for checking the tests so quickly, great catch!

@eGreshkov eGreshkov requested a review from solnic January 20, 2025 11:45
@eGreshkov eGreshkov requested a review from solnic January 20, 2025 12:04
@solnic solnic merged commit d9c279b into getsentry:master Jan 20, 2025
147 checks passed
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

Successfully merging this pull request may close these issues.

2 participants