mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
Rewrite CGI.parse with URI.decode_www_form_component
Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
This commit is contained in:
parent
a23ce6d3a5
commit
f0dda0534b
1 changed files with 10 additions and 3 deletions
|
@ -85,10 +85,17 @@ module Gem::GemcutterUtilities
|
|||
end
|
||||
|
||||
def parse_otp_from_uri(uri)
|
||||
require "cgi"
|
||||
query = uri.query
|
||||
return unless query && !query.empty?
|
||||
|
||||
return if uri.query.nil?
|
||||
CGI.parse(uri.query).dig("code", 0)
|
||||
query.split('&') do |param|
|
||||
key, value = param.split('=', 2)
|
||||
if value && Gem::URI.decode_www_form_component(key) == "code"
|
||||
return Gem::URI.decode_www_form_component(value)
|
||||
end
|
||||
end
|
||||
|
||||
nil
|
||||
end
|
||||
|
||||
class SocketResponder
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue