mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-28 04:18:52 -06:00
fix: read variant zip copies as archives
This commit is contained in:
1 parent
51f6898cee
commit
b9441c545d
8 files changed
+52
-12
No files matched your search
@@ -18,6 +18,8 @@ import zipfile
|
||||
from collections import defaultdict
|
||||
from collections.abc import Callable, Iterable, Sequence
|
||||
|
||||
from core.ziptools import is_archive_path
|
||||
|
||||
# A held file larger than this is not read: no chip image is near it.
|
||||
MAX_SOURCE_SIZE = 64 * 1024 * 1024
|
||||
|
||||
@@ -153,7 +155,7 @@ def _held_sources(db: dict) -> list[dict]:
|
||||
continue
|
||||
if 0 < record.get("size", 0) <= MAX_SOURCE_SIZE:
|
||||
sources.append({**record, "group": os.path.dirname(path)})
|
||||
if not path.lower().endswith(".zip"):
|
||||
if not is_archive_path(path):
|
||||
continue
|
||||
try:
|
||||
with zipfile.ZipFile(path) as zf:
|
||||
|
||||
@@ -11,6 +11,7 @@ from pathlib import Path
|
||||
|
||||
from core.hashing import parse_hash_list
|
||||
from core.paths import REPO_ROOT
|
||||
from core.ziptools import is_archive_path
|
||||
from resolve.content import size_fits
|
||||
|
||||
|
||||
@@ -132,7 +133,7 @@ def archive_members(db: dict) -> dict[tuple[str, int], list[tuple[str, str]]]:
|
||||
members: dict[tuple[str, int], list[tuple[str, str]]] = {}
|
||||
for entry in db.get("files", {}).values():
|
||||
path = entry.get("path", "")
|
||||
if not path.endswith(".zip") or not os.path.exists(path):
|
||||
if not is_archive_path(path) or not os.path.exists(path):
|
||||
continue
|
||||
try:
|
||||
with zipfile.ZipFile(path) as archive:
|
||||
|
||||
Reference in new issue
Block a user