diff options
| author | jvoisin | 2014-01-31 03:54:28 +0000 |
|---|---|---|
| committer | jvoisin | 2014-01-31 03:54:28 +0000 |
| commit | 173449009769ce86493a179acb9c66c87125dce3 (patch) | |
| tree | 8cc035901c9cc254370e74514c2f9a7dcee1b48c /MAT | |
| parent | 1ca20db6741dabfbad567aa20bee92069a5ef5c7 (diff) | |
Fix office-format handling by the GUI
Diffstat (limited to 'MAT')
| -rw-r--r-- | MAT/archive.py | 10 | ||||
| -rw-r--r-- | MAT/office.py | 5 |
2 files changed, 12 insertions, 3 deletions
diff --git a/MAT/archive.py b/MAT/archive.py index 3c6a139..62f4ca7 100644 --- a/MAT/archive.py +++ b/MAT/archive.py | |||
| @@ -39,7 +39,7 @@ class GenericArchiveStripper(parser.GenericParser): | |||
| 39 | mat.secure_remove(path_file) | 39 | mat.secure_remove(path_file) |
| 40 | shutil.rmtree(self.tempdir) | 40 | shutil.rmtree(self.tempdir) |
| 41 | 41 | ||
| 42 | def is_clean(self, list_unsupported): | 42 | def is_clean(self, list_unsupported=False): |
| 43 | ''' Virtual method to check for harmul metadata | 43 | ''' Virtual method to check for harmul metadata |
| 44 | ''' | 44 | ''' |
| 45 | raise NotImplementedError | 45 | raise NotImplementedError |
| @@ -312,6 +312,14 @@ class TarStripper(GenericArchiveStripper): | |||
| 312 | return metadata | 312 | return metadata |
| 313 | 313 | ||
| 314 | 314 | ||
| 315 | class TerminalZipStripper(ZipStripper): | ||
| 316 | ''' Represent a terminal level archive. | ||
| 317 | This type of archive can not contain nested archives. | ||
| 318 | It is used for formats like docx, which are basically | ||
| 319 | ziped xml. | ||
| 320 | ''' | ||
| 321 | |||
| 322 | |||
| 315 | class GzipStripper(TarStripper): | 323 | class GzipStripper(TarStripper): |
| 316 | ''' Represent a tar.gz archive | 324 | ''' Represent a tar.gz archive |
| 317 | ''' | 325 | ''' |
diff --git a/MAT/office.py b/MAT/office.py index 97405b3..e4b9567 100644 --- a/MAT/office.py +++ b/MAT/office.py | |||
| @@ -1,4 +1,5 @@ | |||
| 1 | ''' Care about office's formats | 1 | ''' Care about office's formats |
| 2 | |||
| 2 | ''' | 3 | ''' |
| 3 | 4 | ||
| 4 | import logging | 5 | import logging |
| @@ -19,7 +20,7 @@ import parser | |||
| 19 | import archive | 20 | import archive |
| 20 | 21 | ||
| 21 | 22 | ||
| 22 | class OpenDocumentStripper(archive.ZipStripper): | 23 | class OpenDocumentStripper(archive.TerminalZipStripper): |
| 23 | ''' An open document file is a zip, with xml file into. | 24 | ''' An open document file is a zip, with xml file into. |
| 24 | The one that interest us is meta.xml | 25 | The one that interest us is meta.xml |
| 25 | ''' | 26 | ''' |
| @@ -68,7 +69,7 @@ class OpenDocumentStripper(archive.ZipStripper): | |||
| 68 | return False | 69 | return False |
| 69 | 70 | ||
| 70 | 71 | ||
| 71 | class OpenXmlStripper(archive.ZipStripper): | 72 | class OpenXmlStripper(archive.TerminalZipStripper): |
| 72 | ''' Represent an office openxml document, which is like | 73 | ''' Represent an office openxml document, which is like |
| 73 | an opendocument format, with some tricky stuff added. | 74 | an opendocument format, with some tricky stuff added. |
| 74 | It contains mostly xml, but can have media blobs, crap, ... | 75 | It contains mostly xml, but can have media blobs, crap, ... |
