1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[rubygems/rubygems] Use gsub with Hash

https://github.com/rubygems/rubygems/commit/83eced0b39
This commit is contained in:
Kazuhiro NISHIYAMA 2019-08-01 18:00:32 +09:00 committed by Hiroshi SHIBATA
parent 87bc29fe28
commit 42a9e27d84

View file

@ -141,7 +141,7 @@ class Gem::S3URISigner
end
def base64_uri_escape(str)
str.gsub("\n", "").gsub(/[\+\/=]/) { |c| BASE64_URI_TRANSLATE[c] }
str.gsub(/[\+\/=\n]/, BASE64_URI_TRANSLATE)
end
def ec2_metadata_credentials_json
@ -169,7 +169,7 @@ class Gem::S3URISigner
Gem::Request::ConnectionPools.new(proxy_uri, certs).pool_for(uri)
end
BASE64_URI_TRANSLATE = { "+" => "%2B", "/" => "%2F", "=" => "%3D" }.freeze
BASE64_URI_TRANSLATE = { "+" => "%2B", "/" => "%2F", "=" => "%3D", "\n" => "" }.freeze
EC2_METADATA_CREDENTIALS = "http://169.254.169.254/latest/meta-data/identity-credentials/ec2/security-credentials/ec2-instance".freeze
end