diff options
Diffstat (limited to 'MAT')
| -rw-r--r-- | MAT/archive.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/MAT/archive.py b/MAT/archive.py index ed55319..ee5c936 100644 --- a/MAT/archive.py +++ b/MAT/archive.py | |||
| @@ -5,6 +5,7 @@ import datetime | |||
| 5 | import logging | 5 | import logging |
| 6 | import os | 6 | import os |
| 7 | import shutil | 7 | import shutil |
| 8 | import stat | ||
| 8 | import tarfile | 9 | import tarfile |
| 9 | import tempfile | 10 | import tempfile |
| 10 | import zipfile | 11 | import zipfile |
| @@ -160,7 +161,10 @@ class ZipStripper(GenericArchiveStripper): | |||
| 160 | if os.path.isfile(name) and not beginning and not ending: | 161 | if os.path.isfile(name) and not beginning and not ending: |
| 161 | cfile = mat.create_class_file(name, False, add2archive=self.add2archive) | 162 | cfile = mat.create_class_file(name, False, add2archive=self.add2archive) |
| 162 | if cfile is not None: | 163 | if cfile is not None: |
| 164 | old_stat = os.stat(name).st_mode | ||
| 165 | os.chmod(name, old_stat|stat.S_IWUSR) | ||
| 163 | cfile.remove_all() | 166 | cfile.remove_all() |
| 167 | os.chmod(name, old_stat) | ||
| 164 | logging.debug('Processing %s from %s' % (item.filename, self.filename)) | 168 | logging.debug('Processing %s from %s' % (item.filename, self.filename)) |
| 165 | elif item.filename not in whitelist: | 169 | elif item.filename not in whitelist: |
| 166 | logging.info('%s\'s format is not supported or harmless' % item.filename) | 170 | logging.info('%s\'s format is not supported or harmless' % item.filename) |
| @@ -244,10 +248,10 @@ class TarStripper(GenericArchiveStripper): | |||
| 244 | class_file = mat.create_class_file(complete_name, | 248 | class_file = mat.create_class_file(complete_name, |
| 245 | False, add2archive=self.add2archive) | 249 | False, add2archive=self.add2archive) |
| 246 | if class_file: | 250 | if class_file: |
| 247 | # Nested archives are treated like unsupported ones | ||
| 248 | if not class_file.is_clean(): | 251 | if not class_file.is_clean(): |
| 249 | if not list_unsupported: | 252 | if not list_unsupported: |
| 250 | return False | 253 | return False |
| 254 | # Nested archives are treated like unsupported files | ||
| 251 | elif isinstance(class_file, GenericArchiveStripper): | 255 | elif isinstance(class_file, GenericArchiveStripper): |
| 252 | ret_list.append(item.name) | 256 | ret_list.append(item.name) |
| 253 | else: | 257 | else: |
