Skip to content
Snippets Groups Projects
Commit ec784ff1 authored by smagnin's avatar smagnin
Browse files

Correct self method

parent acff1ca6
No related branches found
No related tags found
1 merge request!21Add ZIP archives support
......@@ -49,7 +49,6 @@ class ArchiveBasedAbstractParser(abstract.AbstractParser):
zipinfo.date_time = (1980, 1, 1, 0, 0, 0) # this is as early as a zipfile can be
return zipinfo
@staticmethod
def _get_zipinfo_meta(self, zipinfo: zipfile.ZipInfo) -> Dict[str, str]:
metadata = {}
if zipinfo.create_system == 3: # this is Linux
......@@ -146,7 +145,7 @@ class ZIPParser(ArchiveBasedAbstractParser):
metadata = {}
zipin = zipfile.ZipFile(self.filename)
for item in zipin.infolist():
for key, value in self._get_zipinfo_meta(self, item).items():
for key, value in self._get_zipinfo_meta(item).items():
metadata[key] = value
zipin.close()
return metadata
......@@ -312,7 +312,7 @@ class MSOfficeParser(ArchiveBasedAbstractParser):
metadata[key] = value
except (TypeError, UnicodeDecodeError): # We didn't manage to parse the xml file
metadata[item.filename] = 'harmful content'
for key, value in self._get_zipinfo_meta(self, item).items():
for key, value in self._get_zipinfo_meta(item).items():
metadata[key] = value
zipin.close()
return metadata
......@@ -397,7 +397,7 @@ class LibreOfficeParser(ArchiveBasedAbstractParser):
metadata[key] = value
except (TypeError, UnicodeDecodeError): # We didn't manage to parse the xml file
metadata[item.filename] = 'harmful content'
for key, value in self._get_zipinfo_meta(self, item).items():
for key, value in self._get_zipinfo_meta(item).items():
metadata[key] = value
zipin.close()
return metadata
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment