mirror of
https://github.com/rommapp/romm.git
synced 2026-12-03 10:33:22 +01:00
Merge pull request #1936 from rommapp/rahasher-hotfix
[HOTFIX] Fix ramatcher on mult-file games
This commit is contained in:
@@ -6,7 +6,7 @@ from logger.formatter import LIGHTMAGENTA
|
||||
from logger.formatter import highlight as hl
|
||||
from logger.logger import log
|
||||
|
||||
RAHASHER_VALID_HASH_REGEX = re.compile(r"^[0-9a-f]{32}$")
|
||||
RAHASHER_VALID_HASH_REGEX = re.compile(r"[0-9a-f]{32}")
|
||||
|
||||
# TODO: Centralize standarized platform slugs using StrEnum.
|
||||
PLATFORM_SLUG_TO_RETROACHIEVEMENTS_ID: dict[str, int] = {
|
||||
@@ -123,10 +123,12 @@ class RAHasherService:
|
||||
if not file_hash:
|
||||
log.error(f"RAHasher returned an empty hash. {platform_id=}, {file_path=}")
|
||||
return ""
|
||||
if not RAHASHER_VALID_HASH_REGEX.match(file_hash):
|
||||
|
||||
match = RAHASHER_VALID_HASH_REGEX.search(file_hash)
|
||||
if not match:
|
||||
log.error(
|
||||
f"RAHasher returned an invalid hash: {file_hash=}, {platform_id=}, {file_path=}"
|
||||
f"RAHasher returned an invalid hash: {file_hash}. Expected format: {RAHASHER_VALID_HASH_REGEX.pattern}"
|
||||
)
|
||||
return ""
|
||||
|
||||
return file_hash
|
||||
return match.group(0)
|
||||
|
||||
@@ -418,7 +418,7 @@ class FSRomsHandler(FSHandler):
|
||||
ra_hash=(
|
||||
await RAHasherService().calculate_hash(
|
||||
SLUG_TO_RA_ID[rom.platform.slug]["id"],
|
||||
f"{LIBRARY_BASE_PATH}/{rom.fs_path}/{rom.fs_name}",
|
||||
f"{LIBRARY_BASE_PATH}/{rom.fs_path}/{rom.fs_name}{'/*' if rom.multi else ''}",
|
||||
)
|
||||
if rom.platform.slug in SLUG_TO_RA_ID.keys()
|
||||
else ""
|
||||
|
||||
Reference in New Issue
Block a user