mirror of
https://github.com/Abdess/retrobios.git
synced 2026-06-19 10:32:47 +00:00
fix: trust full MD5 for cross-name variant resolution
This commit is contained in:
parent
03002515fe
commit
2d17e0e9d9
1 changed files with 6 additions and 2 deletions
|
|
@ -436,8 +436,12 @@ def resolve_local_file(
|
|||
sha1_match = by_md5.get(md5_candidate)
|
||||
if sha1_match and sha1_match in files_db:
|
||||
path = files_db[sha1_match]["path"]
|
||||
if os.path.exists(path) and _md5_name_ok(path):
|
||||
return path, "md5_exact"
|
||||
# Full MD5 (32 chars) is a strong identifier: trust it
|
||||
# without name guard. Truncated MD5 still needs name check
|
||||
# to avoid cross-contamination.
|
||||
if os.path.exists(path):
|
||||
if len(md5_candidate) >= 32 or _md5_name_ok(path):
|
||||
return path, "md5_exact"
|
||||
if len(md5_candidate) < 32:
|
||||
for db_md5, db_sha1 in by_md5.items():
|
||||
if db_md5.startswith(md5_candidate) and db_sha1 in files_db:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue