fix: refuse an unparseable platform original

This commit is contained in:
Abdessamad Derraz committed 2026-10-18 14:57:28 +02:00
1 parent be0443a935
commit 213d19ed27
3 files changed
+36 -4

No files matched your search

+7 -2
View File
@@ -131,8 +131,13 @@ class Exporter(BaseExporter):
if original:
try:
root = parse_untrusted_xml(original, self.native_filename(), comments=True)
except (ParseError, ValueError):
root = None
except (ParseError, ValueError) as exc:
# Rebuilt from our model alone, the export would drop every
# system we do not transcribe and the maintainer's comments.
raise ValueError(
f"Recalbox's {self.native_filename()} does not parse ({exc}); "
"fetch it again with --refresh-cache"
) from exc
if root is not None:
theirs = [
(s.get("platform", ""), s.get("fullname", ""), [
+5 -2
View File
@@ -69,8 +69,11 @@ class Exporter(BaseExporter):
if original:
try:
base = json.loads(original, object_pairs_hook=OrderedDict)
except json.JSONDecodeError:
base = {}
except json.JSONDecodeError as exc:
raise ValueError(
f"RetroBat's {self.native_filename()} does not parse ({exc}); "
"fetch it again with --refresh-cache"
) from exc
exportable = {
system.native_id: (system, files)