From ec84bfc9e3d11a3b1dbebcaf4d1ddf1357307513 Mon Sep 17 00:00:00 2001 From: ryan Date: Tue, 1 Feb 2011 03:11:34 +0000 Subject: Import rubygems 1.5.0 (released version @ 1fb59d0) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30752 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/rubygems/format.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'lib/rubygems/format.rb') diff --git a/lib/rubygems/format.rb b/lib/rubygems/format.rb index 3b38a3a017..95388b4e51 100644 --- a/lib/rubygems/format.rb +++ b/lib/rubygems/format.rb @@ -47,8 +47,13 @@ class Gem::Format Gem::OldFormat.from_file_by_path file_path else - open file_path, Gem.binary_mode do |io| - from_io io, file_path, security_policy + begin + open file_path, Gem.binary_mode do |io| + from_io io, file_path, security_policy + end + rescue Gem::Package::TarInvalidError => e + message = "corrupt gem (#{e.class}: #{e.message})" + raise Gem::Package::FormatError.new(message, file_path) end end end -- cgit v1.2.3