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 <noreply@anthropic.com>
This commit is contained in:
Valiantsin DzerakhandClaude Opus 5.5 committed 2026-11-22 16:02:34 +03:00
1 parent 2593618a65
commit 4c4d1310a5
2 files changed
+3 -1

No files matched your search

+2
View File
@@ -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')
+1 -1
View File
@@ -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: