Recognize 7z files by magic bytes, not filename

This commit is contained in:
Jack Nagel 2013-04-03 23:30:32 -05:00
parent 12932a51b3
commit df29049222

View File

@ -188,13 +188,13 @@ class Pathname
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
end
end
end