diff options
| author | jvoisin | 2018-04-02 23:35:03 +0200 |
|---|---|---|
| committer | jvoisin | 2018-04-02 23:35:03 +0200 |
| commit | 721ee78d15b69d06bd46920a2c1e988ea8d44288 (patch) | |
| tree | 63d2a7d5f4e251d49fcd7b806bc19c310581fbef /src | |
| parent | 0cc7e1e68075b8366c358031d91393d1ac74fb01 (diff) | |
Fix a mistake wrt. office handling
Diffstat (limited to 'src')
| -rw-r--r-- | src/office.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/office.py b/src/office.py index 8d478c1..1c5e795 100644 --- a/src/office.py +++ b/src/office.py | |||
| @@ -39,14 +39,14 @@ class ArchiveBasedAbstractParser(abstract.AbstractParser): | |||
| 39 | def _clean_internal_file(self, item:zipfile.ZipInfo, temp_folder:str, zin:zipfile.ZipFile, zout:zipfile.ZipFile): | 39 | def _clean_internal_file(self, item:zipfile.ZipInfo, temp_folder:str, zin:zipfile.ZipFile, zout:zipfile.ZipFile): |
| 40 | zin.extract(member=item, path=temp_folder) | 40 | zin.extract(member=item, path=temp_folder) |
| 41 | tmp_parser, mtype = parser_factory.get_parser(os.path.join(temp_folder, item.filename)) | 41 | tmp_parser, mtype = parser_factory.get_parser(os.path.join(temp_folder, item.filename)) |
| 42 | if tmp_parser is None: | 42 | if not tmp_parser: |
| 43 | print("%s's format (%s) isn't supported" % (item.filename, mtype)) | 43 | print("%s's format (%s) isn't supported" % (item.filename, mtype)) |
| 44 | return | 44 | return |
| 45 | tmp_parser.remove_all() | 45 | tmp_parser.remove_all() |
| 46 | zinfo = zipfile.ZipInfo(item.filename) | 46 | zinfo = zipfile.ZipInfo(item.filename) |
| 47 | item = self._clean_zipinfo(item) | 47 | clean_zinfo = self._clean_zipinfo(zinfo) |
| 48 | with open(tmp_parser.output_filename, 'rb') as f: | 48 | with open(tmp_parser.output_filename, 'rb') as f: |
| 49 | zout.writestr(zinfo, f.read()) | 49 | zout.writestr(clean_zinfo, f.read()) |
| 50 | 50 | ||
| 51 | class MSOfficeParser(ArchiveBasedAbstractParser): | 51 | class MSOfficeParser(ArchiveBasedAbstractParser): |
| 52 | mimetypes = { | 52 | mimetypes = { |
