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): def _clean_internal_file(self, item:zipfile.ZipInfo, temp_folder:str, zin:zipfile.ZipFile, zout:zipfile.ZipFile): zin.extract(member=item, path=temp_folder) tmp_parser, mtype = parser_factory.get_parser(os.path.join(temp_folder, item.filename)) - if tmp_parser is None: + if not tmp_parser: print("%s's format (%s) isn't supported" % (item.filename, mtype)) return tmp_parser.remove_all() zinfo = zipfile.ZipInfo(item.filename) - item = self._clean_zipinfo(item) + clean_zinfo = self._clean_zipinfo(zinfo) with open(tmp_parser.output_filename, 'rb') as f: - zout.writestr(zinfo, f.read()) + zout.writestr(clean_zinfo, f.read()) class MSOfficeParser(ArchiveBasedAbstractParser): mimetypes = {