From 4c4d1310a5668599c8b39b49765a9595644931c1 Mon Sep 17 00:00:00 2001 From: Valiantsin Dzerakh Date: Sun, 22 Nov 2026 16:02:34 +0300 Subject: [PATCH] A quoted plugin image path that is empty is a patch table error with its line, not a read of the folder Co-Authored-By: Claude Opus 5.5 --- recomp/patches.py | 2 ++ tests/exefs_plugins_test.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/recomp/patches.py b/recomp/patches.py index 170e540f..58bf3c1f 100644 --- a/recomp/patches.py +++ b/recomp/patches.py @@ -196,6 +196,8 @@ def load(path, mods): image, end = json.JSONDecoder().raw_decode(prefix[4]) except json.JSONDecodeError as e: raise PatchError(f'{where}: invalid quoted plugin image: {e.msg}') from None + if not image: + raise PatchError(f'{where}: empty quoted plugin image') tail = prefix[4][end:].strip() if tail and not tail.startswith('#'): raise PatchError(f'{where}: unexpected text after quoted plugin image') diff --git a/tests/exefs_plugins_test.py b/tests/exefs_plugins_test.py index 2f6d4bd0..b35f4549 100644 --- a/tests/exefs_plugins_test.py +++ b/tests/exefs_plugins_test.py @@ -390,7 +390,7 @@ class Lines(unittest.TestCase): mods = [('main', MAIN, 0x200000), ('plugin0', PLUGIN, 0x14000)] with tempfile.TemporaryDirectory() as d: patch = Path(d) / 'patches.txt' - for field in ('"unfinished', '"image.img" extra', '"image.img" "#not a comment"'): + for field in ('"unfinished', '""', '"image.img" extra', '"image.img" "#not a comment"'): with self.subTest(field=field): patch.write_text(f'set x ENV 0\nplugin x plugin0 {"0" * 64} {field}\n') with self.assertRaises(patches.PatchError) as error: