diff options
| author | Jack Nagel | 2013-04-03 23:30:32 -0500 |
|---|---|---|
| committer | Jack Nagel | 2013-04-03 23:30:32 -0500 |
| commit | bd15c06992f33f930ade038f8261dcf69c814c6c (patch) | |
| tree | cb11613e1a6077ad7c51ead4f56a3c64e478affc /Library/Homebrew/extend | |
| parent | 2005cfc472ddaf9ee39ae3958c344adfa7bd4b92 (diff) | |
| download | homebrew-bd15c06992f33f930ade038f8261dcf69c814c6c.tar.bz2 | |
Recognize 7z files by magic bytes, not filename
Diffstat (limited to 'Library/Homebrew/extend')
| -rw-r--r-- | Library/Homebrew/extend/pathname.rb | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/Library/Homebrew/extend/pathname.rb b/Library/Homebrew/extend/pathname.rb index df32e8870..1f384db73 100644 --- a/Library/Homebrew/extend/pathname.rb +++ b/Library/Homebrew/extend/pathname.rb @@ -181,20 +181,20 @@ class Pathname # POSIX tar magic has a 257 byte offset # magic numbers stolen from /usr/share/file/magic/ case open { |f| f.read(262) } - when /^PK\003\004/n then :zip - when /^\037\213/n then :gzip - when /^BZh/n then :bzip2 - when /^\037\235/n then :compress - when /^.{257}ustar/n then :tar - when /^\xFD7zXZ\x00/n then :xz - when /^Rar!/n then :rar + when /^PK\003\004/n then :zip + when /^\037\213/n then :gzip + when /^BZh/n then :bzip2 + when /^\037\235/n then :compress + when /^.{257}ustar/n then :tar + when /^\xFD7zXZ\x00/n then :xz + when /^Rar!/n then :rar + when /^7z\xBC\xAF\x27\x1C/n then :p7zip else # 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 - when ".7z" then :p7zip + when ".tar.gz", ".tgz", ".tar.bz2", ".tbz" then :tar + when ".zip" then :zip end end end |
