From 7bf1d8d1e79ed77cb9748df694700247ba52470d Mon Sep 17 00:00:00 2001 From: jvoisin Date: Sat, 18 Jan 2014 02:00:08 +0000 Subject: Fix a zipinfo issue MAT will now returns correct results when asked to get non-supported files from a zip archive with a comment --- MAT/archive.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/MAT/archive.py b/MAT/archive.py index 53c5e9b..ed55319 100644 --- a/MAT/archive.py +++ b/MAT/archive.py @@ -72,7 +72,7 @@ class ZipStripper(GenericArchiveStripper): if list_unsupported: ret_list = [] zipin = zipfile.ZipFile(self.filename, 'r') - if zipin.comment != '': + if zipin.comment != '' and not list_unsupported: logging.debug('%s has a comment' % self.filename) return False for item in zipin.infolist(): @@ -201,11 +201,12 @@ class TarStripper(GenericArchiveStripper): if cfile: cfile.remove_all() elif self.add2archive or os.path.splitext(item.name)[1] in parser.NOMETA: - logging.info('%s\' format is either not supported or harmless' % item.name) + logging.debug('%s\' format is either not supported or harmless' % item.name) elif item.name in whitelist: logging.debug('%s is not supported, but MAT was told to add it anyway.' % item.name) - else: + else: # Don't add the file to the archive + logging.debug('%s will not be added' % item.name) continue tarout.add(complete_name, item.name, filter=self._remove) tarin.close() @@ -243,7 +244,7 @@ class TarStripper(GenericArchiveStripper): class_file = mat.create_class_file(complete_name, False, add2archive=self.add2archive) if class_file: - # We don't support nested archives + # Nested archives are treated like unsupported ones if not class_file.is_clean(): if not list_unsupported: return False -- cgit v1.3