1
0
mirror of synced 2024-11-22 09:14:23 +01:00

Fix a mistake wrt. office handling

This commit is contained in:
jvoisin 2018-04-02 23:35:03 +02:00
parent 0cc7e1e680
commit 721ee78d15

View File

@ -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 = {