summaryrefslogtreecommitdiff
path: root/MAT
diff options
context:
space:
mode:
authorjvoisin2014-01-18 02:00:08 +0000
committerjvoisin2014-01-18 02:00:08 +0000
commit7bf1d8d1e79ed77cb9748df694700247ba52470d (patch)
tree082cee011217e5a81f03515b7146d882c48d46bc /MAT
parentf325f3abaee44f7a3e28a72058abac8b2e51805a (diff)
Fix a zipinfo issue
MAT will now returns correct results when asked to get non-supported files from a zip archive with a comment
Diffstat (limited to '')
-rw-r--r--MAT/archive.py9
1 files 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):
72 if list_unsupported: 72 if list_unsupported:
73 ret_list = [] 73 ret_list = []
74 zipin = zipfile.ZipFile(self.filename, 'r') 74 zipin = zipfile.ZipFile(self.filename, 'r')
75 if zipin.comment != '': 75 if zipin.comment != '' and not list_unsupported:
76 logging.debug('%s has a comment' % self.filename) 76 logging.debug('%s has a comment' % self.filename)
77 return False 77 return False
78 for item in zipin.infolist(): 78 for item in zipin.infolist():
@@ -201,11 +201,12 @@ class TarStripper(GenericArchiveStripper):
201 if cfile: 201 if cfile:
202 cfile.remove_all() 202 cfile.remove_all()
203 elif self.add2archive or os.path.splitext(item.name)[1] in parser.NOMETA: 203 elif self.add2archive or os.path.splitext(item.name)[1] in parser.NOMETA:
204 logging.info('%s\' format is either not supported or harmless' % item.name) 204 logging.debug('%s\' format is either not supported or harmless' % item.name)
205 elif item.name in whitelist: 205 elif item.name in whitelist:
206 logging.debug('%s is not supported, but MAT was told to add it anyway.' 206 logging.debug('%s is not supported, but MAT was told to add it anyway.'
207 % item.name) 207 % item.name)
208 else: 208 else: # Don't add the file to the archive
209 logging.debug('%s will not be added' % item.name)
209 continue 210 continue
210 tarout.add(complete_name, item.name, filter=self._remove) 211 tarout.add(complete_name, item.name, filter=self._remove)
211 tarin.close() 212 tarin.close()
@@ -243,7 +244,7 @@ class TarStripper(GenericArchiveStripper):
243 class_file = mat.create_class_file(complete_name, 244 class_file = mat.create_class_file(complete_name,
244 False, add2archive=self.add2archive) 245 False, add2archive=self.add2archive)
245 if class_file: 246 if class_file:
246 # We don't support nested archives 247 # Nested archives are treated like unsupported ones
247 if not class_file.is_clean(): 248 if not class_file.is_clean():
248 if not list_unsupported: 249 if not list_unsupported:
249 return False 250 return False