[rubygems/rubygems] Swapping should not raise any errors

https://github.com/rubygems/rubygems/commit/600a9ac658
This commit is contained in:
David Rodríguez 2022-06-09 11:06:32 +02:00 committed by git
parent 6292b36529
commit bf8dc36e40

View File

@ -157,11 +157,12 @@ module Bundler
path = fetch_gem(spec, options[:previous_spec]) path = fetch_gem(spec, options[:previous_spec])
begin begin
s = Bundler.rubygems.spec_from_gem(path, Bundler.settings["trust-policy"]) s = Bundler.rubygems.spec_from_gem(path, Bundler.settings["trust-policy"])
spec.__swap__(s)
rescue Gem::Package::FormatError rescue Gem::Package::FormatError
Bundler.rm_rf(path) Bundler.rm_rf(path)
raise raise
end end
spec.__swap__(s)
else else
path = cached_gem(spec) path = cached_gem(spec)
raise GemNotFound, "Could not find #{spec.file_name} for installation" unless path raise GemNotFound, "Could not find #{spec.file_name} for installation" unless path