diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/office.py | 4 | ||||
| -rw-r--r-- | src/parser_factory.py | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/office.py b/src/office.py index 0a34185..8d478c1 100644 --- a/src/office.py +++ b/src/office.py | |||
| @@ -38,9 +38,9 @@ class ArchiveBasedAbstractParser(abstract.AbstractParser): | |||
| 38 | 38 | ||
| 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 = 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 tmp_parser is None: |
| 43 | print("%s isn't supported" % item.filename) | 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) |
diff --git a/src/parser_factory.py b/src/parser_factory.py index 176ff2b..226234b 100644 --- a/src/parser_factory.py +++ b/src/parser_factory.py | |||
| @@ -15,6 +15,6 @@ def get_parser(filename: str): | |||
| 15 | mtype, _ = mimetypes.guess_type(filename) | 15 | mtype, _ = mimetypes.guess_type(filename) |
| 16 | for c in abstract.AbstractParser.__subclasses__(): | 16 | for c in abstract.AbstractParser.__subclasses__(): |
| 17 | if mtype in c.mimetypes: | 17 | if mtype in c.mimetypes: |
| 18 | return c(filename) | 18 | return c(filename), mtype |
| 19 | print('factory: %s is not supported' % mtype) | 19 | print('factory: %s is not supported' % mtype) |
| 20 | return None | 20 | return None, mtype |
