Skip to content

Commit

Permalink
[rb] Resolve uri gem deprecation warning (#14770)
Browse files Browse the repository at this point in the history
> /home/user/.rbenv/versions/3.3.6/lib/ruby/gems/3.3.0/gems/selenium-webdriver-4.26.0/lib/selenium/webdriver/remote/bridge.rb:679: warning: URI::RFC3986_PARSER.escape is obsoleted. Use URI::RFC2396_PARSER.escape explicitly.

Ruby switches the default parser from RFC2396 to RFC3986. This parser contains
all methods from the old parser but delegates to RFC2396 for a few and warns.
Namely `extract`, `make_regexp`, `escape`, and `unescape`.

selenium currently supports Ruby >= 3.1, so the current old compatibility code is unnecessary.
`RFC2396_PARSER` is a somewhat new addition, so some kind of check is still needed.
It is available in Ruby 3.1 but early patch versions are missing it.
  • Loading branch information
Earlopain authored Nov 19, 2024
1 parent b164d85 commit 751bacb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion rb/lib/selenium/webdriver/remote/bridge.rb
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ def execute(command, opts = {}, command_hash = nil)
end

def escaper
@escaper ||= defined?(URI::Parser) ? URI::DEFAULT_PARSER : URI
@escaper ||= defined?(URI::RFC2396_PARSER) ? URI::RFC2396_PARSER : URI::DEFAULT_PARSER
end

def commands(command)
Expand Down

0 comments on commit 751bacb

Please sign in to comment.