Skip to content

Commit 649597b

Browse files
committed
fix RA badgeds download
1 parent e723664 commit 649597b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

backend/models/rom.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from __future__ import annotations
22

3+
import copy
34
import enum
45
from datetime import datetime
56
from functools import cached_property
@@ -393,13 +394,18 @@ def alternative_names(self) -> list[str]:
393394
@cached_property
394395
def merged_ra_metadata(self) -> dict[str, list] | None:
395396
if self.ra_metadata and "achievements" in self.ra_metadata:
396-
for achievement in self.ra_metadata.get("achievements", []):
397+
# Create a deep copy to avoid mutating the original metadata
398+
# This ensures that badge paths remain relative for filesystem operations
399+
# while the frontend receives absolute paths
400+
metadata_copy = copy.deepcopy(self.ra_metadata)
401+
for achievement in metadata_copy.get("achievements", []):
397402
achievement["badge_path_lock"] = (
398403
f"{FRONTEND_RESOURCES_PATH}/{achievement['badge_path_lock']}"
399404
)
400405
achievement["badge_path"] = (
401406
f"{FRONTEND_RESOURCES_PATH}/{achievement['badge_path']}"
402407
)
408+
return metadata_copy
403409
return self.ra_metadata
404410

405411
# Used only during scan process

0 commit comments

Comments
 (0)