From 05991dd846ac54b10cd78453b140de8bfb259392 Mon Sep 17 00:00:00 2001 From: Max Howell Date: Wed, 22 Aug 2012 09:33:10 -0400 Subject: Produce good error messages for bad tarballs --- Library/Homebrew/extend/pathname.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'Library') diff --git a/Library/Homebrew/extend/pathname.rb b/Library/Homebrew/extend/pathname.rb index 8009e98ee..8ea1b9a93 100644 --- a/Library/Homebrew/extend/pathname.rb +++ b/Library/Homebrew/extend/pathname.rb @@ -189,8 +189,12 @@ class Pathname when /^\xFD7zXZ\x00/ then :xz when /^Rar!/ then :rar else - # Assume it is not an archive - nil + # This code so that bad-tarballs and zips produce good error messages + # when they don't unarchive properly. + case extname + when ".tar.gz", ".tgz", ".tar.bz2", ".tbz" then :tar + when ".zip" then :zip + end end end -- cgit v1.2.3