Reject a non-string execute command with a clear installer error

This commit is contained in:
dualfroz committed 2026-10-12 19:30:15 +02:00
1 parent 4e152e4bd7
commit ef84199f8f
2 files changed
+11

No files matched your search

+5
View File
@@ -119,6 +119,11 @@ class CommandsMixin:
exec_path = data.get("file", "")
command = data.get("command", "")
if not isinstance(command, str):
raise ScriptingError(
_("The command parameter of the execute command must be a string"),
faulty_data=data,
)
args_string = data.get("args", "")
for arg in shlex.split(args_string):
args.append(self._substitute(arg))
+6
View File
@@ -78,6 +78,12 @@ class TestScriptInterpreter(TestCase):
interpreter._map_command({"_substitute": "foo"})
self.assertEqual(ex.exception.message, 'The command "substitute" does not exist.')
def test_execute_rejects_a_command_that_is_not_a_string(self):
interpreter = MockInterpreter(TEST_INSTALLER, None)
with self.assertRaises(ScriptingError) as ex:
interpreter.execute({"command": [["pwd"]]})
self.assertEqual(ex.exception.message, "The command parameter of the execute command must be a string")
def test_prepare_game_files_resolves_moddb_url(self):
moddb_url = "https://www.moddb.com/downloads/test-file"
mirror_url = "https://www.moddb.com/downloads/mirror/test-file"