Fix a mistake wrt. office handling
This commit is contained in:
parent
0cc7e1e680
commit
721ee78d15
@ -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):
|
def _clean_internal_file(self, item:zipfile.ZipInfo, temp_folder:str, zin:zipfile.ZipFile, zout:zipfile.ZipFile):
|
||||||
zin.extract(member=item, path=temp_folder)
|
zin.extract(member=item, path=temp_folder)
|
||||||
tmp_parser, mtype = parser_factory.get_parser(os.path.join(temp_folder, item.filename))
|
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))
|
print("%s's format (%s) isn't supported" % (item.filename, mtype))
|
||||||
return
|
return
|
||||||
tmp_parser.remove_all()
|
tmp_parser.remove_all()
|
||||||
zinfo = zipfile.ZipInfo(item.filename)
|
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:
|
with open(tmp_parser.output_filename, 'rb') as f:
|
||||||
zout.writestr(zinfo, f.read())
|
zout.writestr(clean_zinfo, f.read())
|
||||||
|
|
||||||
class MSOfficeParser(ArchiveBasedAbstractParser):
|
class MSOfficeParser(ArchiveBasedAbstractParser):
|
||||||
mimetypes = {
|
mimetypes = {
|
||||||
|
Loading…
Reference in New Issue
Block a user