diff options
Diffstat (limited to 'lib/archive.py')
| -rw-r--r-- | lib/archive.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/archive.py b/lib/archive.py index 3f16ee4..c97385b 100644 --- a/lib/archive.py +++ b/lib/archive.py | |||
| @@ -26,8 +26,13 @@ class GenericArchiveStripper(parser.GenericParser): | |||
| 26 | 26 | ||
| 27 | def __del__(self): | 27 | def __del__(self): |
| 28 | ''' | 28 | ''' |
| 29 | Remove the temp dir | 29 | Remove the files inside the temp dir, |
| 30 | then remove the temp dir | ||
| 30 | ''' | 31 | ''' |
| 32 | for root, dirs, files in os.walk(self.tempdir): | ||
| 33 | for item in files: | ||
| 34 | path_file = os.path.join(root, item) | ||
| 35 | mat.secure_remove(path_file) | ||
| 31 | shutil.rmtree(self.tempdir) | 36 | shutil.rmtree(self.tempdir) |
| 32 | 37 | ||
| 33 | def remove_all(self): | 38 | def remove_all(self): |
| @@ -101,7 +106,6 @@ harmless format' % item.filename) | |||
| 101 | if ext not in parser.NOMETA: | 106 | if ext not in parser.NOMETA: |
| 102 | if bname != 'mimetype' and bname != '.rels': | 107 | if bname != 'mimetype' and bname != '.rels': |
| 103 | return False | 108 | return False |
| 104 | mat.secure_remove(name) | ||
| 105 | zipin.close() | 109 | zipin.close() |
| 106 | return True | 110 | return True |
| 107 | 111 | ||
| @@ -152,7 +156,6 @@ harmless format' % item.filename) | |||
| 152 | _, ext = os.path.splitext(name) | 156 | _, ext = os.path.splitext(name) |
| 153 | if self.add2archive or ext in parser.NOMETA: | 157 | if self.add2archive or ext in parser.NOMETA: |
| 154 | zipout.write(name, item.filename) | 158 | zipout.write(name, item.filename) |
| 155 | mat.secure_remove(name) | ||
| 156 | zipout.comment = '' | 159 | zipout.comment = '' |
| 157 | zipin.close() | 160 | zipin.close() |
| 158 | zipout.close() | 161 | zipout.close() |
| @@ -197,7 +200,6 @@ class TarStripper(GenericArchiveStripper): | |||
| 197 | _, ext = os.path.splitext(name) | 200 | _, ext = os.path.splitext(name) |
| 198 | if self.add2archive or ext in parser.NOMETA: | 201 | if self.add2archive or ext in parser.NOMETA: |
| 199 | tarout.add(name, item.name, filter=self._remove) | 202 | tarout.add(name, item.name, filter=self._remove) |
| 200 | mat.secure_remove(name) | ||
| 201 | tarin.close() | 203 | tarin.close() |
| 202 | tarout.close() | 204 | tarout.close() |
| 203 | self.do_backup() | 205 | self.do_backup() |
| @@ -244,7 +246,6 @@ class TarStripper(GenericArchiveStripper): | |||
| 244 | if ext not in parser.NOMETA: | 246 | if ext not in parser.NOMETA: |
| 245 | tarin.close() | 247 | tarin.close() |
| 246 | return False | 248 | return False |
| 247 | mat.secure_remove(name) | ||
| 248 | tarin.close() | 249 | tarin.close() |
| 249 | return True | 250 | return True |
| 250 | 251 | ||
