diff options
| -rw-r--r-- | lib/bundler/settings.rb | 2 | ||||
| -rw-r--r-- | spec/bundler/commands/config_spec.rb | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/lib/bundler/settings.rb b/lib/bundler/settings.rb index 4cd189af12..878747a53b 100644 --- a/lib/bundler/settings.rb +++ b/lib/bundler/settings.rb @@ -493,7 +493,7 @@ module Bundler return {} unless valid_file serializer_class.load(file.read).inject({}) do |config, (k, v)| k = k.dup - k << "/" if /https?:/i.match?(k) && !%r{/\Z}.match?(k) + k << "/" if /https?:/i.match?(k) && !k.end_with?("/", "__#{FALLBACK_TIMEOUT_URI_OPTION.upcase}") k.gsub!(".", "__") unless k.start_with?("#") diff --git a/spec/bundler/commands/config_spec.rb b/spec/bundler/commands/config_spec.rb index e35344de23..d6a30eae5b 100644 --- a/spec/bundler/commands/config_spec.rb +++ b/spec/bundler/commands/config_spec.rb @@ -358,6 +358,12 @@ end E expect(out).to eq("http://gems.example.org/ => http://gem-mirror.example.org/") end + + it "allows configuring fallback timeout for each mirror, and does not duplicate configs", rubygems: ">= 3.5.12" do + bundle "config set --global mirror.https://rubygems.org.fallback_timeout 1" + bundle "config set --global mirror.https://rubygems.org.fallback_timeout 2" + expect(File.read(home(".bundle/config"))).to include("BUNDLE_MIRROR").once + end end describe "quoting" do |
