diff options
Diffstat (limited to 'MAT')
| -rw-r--r-- | MAT/archive.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/MAT/archive.py b/MAT/archive.py index 5b8d9a8..8112f5d 100644 --- a/MAT/archive.py +++ b/MAT/archive.py | |||
| @@ -167,7 +167,7 @@ class TarStripper(GenericArchiveStripper): | |||
| 167 | current_file.gname = '' | 167 | current_file.gname = '' |
| 168 | return current_file | 168 | return current_file |
| 169 | 169 | ||
| 170 | def remove_all(self): | 170 | def remove_all(self, exclude_list=[]): |
| 171 | tarin = tarfile.open(self.filename, 'r' + self.compression, encoding='utf-8') | 171 | tarin = tarfile.open(self.filename, 'r' + self.compression, encoding='utf-8') |
| 172 | tarout = tarfile.open(self.output, 'w' + self.compression, encoding='utf-8') | 172 | tarout = tarfile.open(self.output, 'w' + self.compression, encoding='utf-8') |
| 173 | for item in tarin.getmembers(): | 173 | for item in tarin.getmembers(): |
| @@ -208,6 +208,7 @@ class TarStripper(GenericArchiveStripper): | |||
| 208 | ''' | 208 | ''' |
| 209 | if list_unsupported: | 209 | if list_unsupported: |
| 210 | ret_list = [] | 210 | ret_list = [] |
| 211 | tmp_len = len(self.tempdir) + 1 # trim the tempfile path | ||
| 211 | tarin = tarfile.open(self.filename, 'r' + self.compression) | 212 | tarin = tarfile.open(self.filename, 'r' + self.compression) |
| 212 | for item in tarin.getmembers(): | 213 | for item in tarin.getmembers(): |
| 213 | if not self.is_file_clean(item) and not list_unsupported: | 214 | if not self.is_file_clean(item) and not list_unsupported: |
| @@ -217,14 +218,18 @@ class TarStripper(GenericArchiveStripper): | |||
| 217 | if item.isfile(): | 218 | if item.isfile(): |
| 218 | class_file = mat.create_class_file(complete_name, False, add2archive=self.add2archive) | 219 | class_file = mat.create_class_file(complete_name, False, add2archive=self.add2archive) |
| 219 | if class_file: | 220 | if class_file: |
| 220 | if not class_file.is_clean() and not list_unsupported: | 221 | if not class_file.is_clean(): |
| 221 | return False | 222 | # We don't support nested archives |
| 223 | if list_unsupported: | ||
| 224 | if isinstance(class_file, GenericArchiveStripper): | ||
| 225 | ret_list.append(complete_name[tmp_len:]) | ||
| 226 | else: | ||
| 227 | return False | ||
| 222 | else: | 228 | else: |
| 223 | logging.error('%s\'s format is not supported or harmless' % item.name) | 229 | logging.error('%s\'s format is not supported or harmless' % item.name) |
| 224 | basename, ext = os.path.splitext(complete_name) | 230 | basename, ext = os.path.splitext(complete_name) |
| 225 | if ext not in parser.NOMETA: | 231 | if ext not in parser.NOMETA: |
| 226 | if list_unsupported: | 232 | if list_unsupported: |
| 227 | tmp_len = len(self.tempdir) + 1 # trim the tempfile path | ||
| 228 | ret_list.append(complete_name[tmp_len:]) | 233 | ret_list.append(complete_name[tmp_len:]) |
| 229 | else: | 234 | else: |
| 230 | return False | 235 | return False |
