fix: pick the archive whose member matches

This commit is contained in:
Abdessamad Derraz committed 2026-10-16 10:18:53 +02:00
1 parent f84551dc5f
commit 702e3f14a8
2 files changed
+30

No files matched your search

+6
View File
@@ -958,6 +958,12 @@ def resolve_local_file(
valid.append((path, m, size))
except (zipfile.BadZipFile, OSError):
pass
# The archive whose member carries the declared md5 is the one:
# neogeo.zip is held twice, each with its own sfix.sfix, and the
# first by name was returned as a mismatch while the other matched.
for path, _m, _size in sorted(valid, key=lambda c: "/.variants/" in c[0]):
if any(check_inside_zip(path, zipped_file, md5) == "ok" for md5 in md5_list):
return path, "zip_exact"
if valid:
primary = [c[0] for c in valid if "/.variants/" not in c[0]]
return (primary[0] if primary else valid[0][0]), "hash_mismatch"