Insert archive members in lexicographic order
This commit is contained in:
parent
9275d64be5
commit
a1a06d023e
@ -74,7 +74,9 @@ class ArchiveBasedAbstractParser(abstract.AbstractParser):
|
|||||||
temp_folder = tempfile.mkdtemp()
|
temp_folder = tempfile.mkdtemp()
|
||||||
abort = False
|
abort = False
|
||||||
|
|
||||||
for item in zin.infolist():
|
# Since files order is a fingerprint factor,
|
||||||
|
# we're iterating (and thus inserting) them in lexicographic order.
|
||||||
|
for item in sorted(zin.infolist(), key=lambda z: z.filename):
|
||||||
if item.filename[-1] == '/': # `is_dir` is added in Python3.6
|
if item.filename[-1] == '/': # `is_dir` is added in Python3.6
|
||||||
continue # don't keep empty folders
|
continue # don't keep empty folders
|
||||||
|
|
||||||
@ -92,8 +94,7 @@ class ArchiveBasedAbstractParser(abstract.AbstractParser):
|
|||||||
pass
|
pass
|
||||||
elif any(map(lambda r: r.search(item.filename), self.files_to_omit)):
|
elif any(map(lambda r: r.search(item.filename), self.files_to_omit)):
|
||||||
continue
|
continue
|
||||||
else:
|
else: # supported files that we want to first clean, then add
|
||||||
# supported files that we want to clean then add
|
|
||||||
tmp_parser, mtype = parser_factory.get_parser(full_path) # type: ignore
|
tmp_parser, mtype = parser_factory.get_parser(full_path) # type: ignore
|
||||||
if not tmp_parser:
|
if not tmp_parser:
|
||||||
if self.unknown_member_policy == UnknownMemberPolicy.OMIT:
|
if self.unknown_member_policy == UnknownMemberPolicy.OMIT:
|
||||||
|
Loading…
Reference in New Issue
Block a user