aboutsummaryrefslogtreecommitdiffstats
path: root/lib/bundler/source
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2022-06-09 11:22:45 +0200
committergit <svn-admin@ruby-lang.org>2022-06-11 18:43:27 +0900
commit965c314e34d05b196c8e079f868e79633076ad4c (patch)
tree1f976339a96f8be2acff2279aa180275420c1769 /lib/bundler/source
parentbf8dc36e40168737da5009d20ab1902557e58935 (diff)
downloadruby-965c314e34d05b196c8e079f868e79633076ad4c.tar.gz
[rubygems/rubygems] Move security exception handling to the only place using it
https://github.com/rubygems/rubygems/commit/ba975b3b7f
Diffstat (limited to 'lib/bundler/source')
-rw-r--r--lib/bundler/source/rubygems.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/bundler/source/rubygems.rb b/lib/bundler/source/rubygems.rb
index 2232e04de5..3cb79667d8 100644
--- a/lib/bundler/source/rubygems.rb
+++ b/lib/bundler/source/rubygems.rb
@@ -157,6 +157,10 @@ module Bundler
path = fetch_gem(spec, options[:previous_spec])
begin
s = Bundler.rubygems.spec_from_gem(path, Bundler.settings["trust-policy"])
+ rescue Gem::Security::Exception => e
+ raise SecurityError,
+ "The gem #{File.basename(path, ".gem")} can't be installed because " \
+ "the security policy didn't allow it, with the message: #{e.message}"
rescue Gem::Package::FormatError
Bundler.rm_rf(path)
raise