summaryrefslogtreecommitdiff
path: root/lib/rubygems/config_file.rb
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2023-04-17 19:21:46 +0900
committergit <svn-admin@ruby-lang.org>2023-04-19 06:56:19 +0000
commit30b3290f266609d502791ec5d2edb4885d89d462 (patch)
treede4d3106684a2bebc8532b957d3d4e4a172edca1 /lib/rubygems/config_file.rb
parentd0dc6179173a79635267bae951352d3dee5c5d13 (diff)
[rubygems/rubygems] Added guard condition for replacing __ variable in YAML keys
https://github.com/rubygems/rubygems/commit/e7d31405ea
Diffstat (limited to 'lib/rubygems/config_file.rb')
-rw-r--r--lib/rubygems/config_file.rb14
1 files changed, 1 insertions, 13 deletions
diff --git a/lib/rubygems/config_file.rb b/lib/rubygems/config_file.rb
index 97c11bd95d..2191a81184 100644
--- a/lib/rubygems/config_file.rb
+++ b/lib/rubygems/config_file.rb
@@ -351,20 +351,8 @@ if you believe they were disclosed to a third party.
return {} unless filename && !filename.empty? && File.exist?(filename)
begin
- content = Bundler::YAMLSerializer.load(File.read(filename))
+ content = Bundler::YAMLSerializer.load(File.read(filename), is_rubygems: true)
if content.is_a? Hash
- content.transform_keys! do |k|
- if k.match?(/__/)
- if k.is_a?(Symbol)
- k.to_s.gsub(/__/,".").to_sym
- else
- k.dup.gsub(/__/,".")
- end
- else
- k
- end
- end
-
content.transform_values! do |v|
if (v.is_a?(Hash) || v.is_a?(String)) && v.empty?
nil