diff options
Diffstat (limited to 'libmat2/office.py')
| -rw-r--r-- | libmat2/office.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/libmat2/office.py b/libmat2/office.py index a5a49cf..aea56b9 100644 --- a/libmat2/office.py +++ b/libmat2/office.py | |||
| @@ -16,6 +16,13 @@ class ArchiveBasedAbstractParser(abstract.AbstractParser): | |||
| 16 | files_to_keep = set() # type: Set[str] | 16 | files_to_keep = set() # type: Set[str] |
| 17 | files_to_omit = set() # type: Set[Pattern] | 17 | files_to_omit = set() # type: Set[Pattern] |
| 18 | 18 | ||
| 19 | def __init__(self, filename): | ||
| 20 | super().__init__(filename) | ||
| 21 | try: # better fail here than later | ||
| 22 | zipfile.ZipFile(self.filename) | ||
| 23 | except zipfile.BadZipFile: | ||
| 24 | raise ValueError | ||
| 25 | |||
| 19 | def _clean_zipinfo(self, zipinfo: zipfile.ZipInfo) -> zipfile.ZipInfo: | 26 | def _clean_zipinfo(self, zipinfo: zipfile.ZipInfo) -> zipfile.ZipInfo: |
| 20 | zipinfo.create_system = 3 # Linux | 27 | zipinfo.create_system = 3 # Linux |
| 21 | zipinfo.comment = b'' | 28 | zipinfo.comment = b'' |
