fix: handle empty/invalid athlete.json in merge, API read, and writer encoding
This commit is contained in:
@@ -285,7 +285,10 @@ async def get_athlete(bincio_session: str | None = Cookie(default=None)) -> JSON
|
||||
athlete_path = dd / "athlete.json"
|
||||
data: dict = {}
|
||||
if athlete_path.exists():
|
||||
data = json.loads(athlete_path.read_text(encoding="utf-8"))
|
||||
try:
|
||||
data = json.loads(athlete_path.read_text(encoding="utf-8"))
|
||||
except (json.JSONDecodeError, OSError):
|
||||
pass
|
||||
# Layer edits/athlete.yaml on top
|
||||
edits_path = dd / "edits" / "athlete.yaml"
|
||||
if edits_path.exists():
|
||||
|
||||
Reference in New Issue
Block a user