Extract the RomFS again when its index on disk cannot be read

A 0.2.8 install's romfs/index.json had two flipped bytes, and the update stopped with an unexpected JSONDecodeError
instead of extracting again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Valiantsin DzerakhandClaude Opus 5.5 committed 2026-11-01 18:08:05 +03:00
1 parent 454f236a0d
commit 2125ad6eea
1 file changed
+4 -1
+4 -1
View File
@@ -143,7 +143,10 @@ def romfs_verified(romfs, expected):
index = romfs / 'index.json'
if not index.is_file() or not (romfs / 'romfs.bin').is_file():
return False
report = json.loads(index.read_text())
try:
report = json.loads(index.read_text())
except ValueError: # damaged on disk (a flipped bit made it unreadable): extract again instead of failing the setup
return False
return report.get('romfs_sha256') == expected['romfs']['sha256'] and report.get('romfs_size') == expected['romfs']['size']