Software /
code /
prosody
Changeset
13483:7b070909bd15
prosodyctl shell: Fix invocation with 3+ command arguments
The code correctly inserted the ',' when there was already a "%q" in the
format string, but then the next argument would fail to match because it
inserted ", %q" instead of "%q". The code now matches both, ensuring the
generated code will not produce a syntax error with multiple arguments.
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Wed, 24 Apr 2024 11:45:37 +0100 |
parents | 13482:4d697961546d |
children | 13484:e22609460975 |
files | util/prosodyctl/shell.lua |
diffstat | 1 files changed, 1 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/util/prosodyctl/shell.lua Tue Apr 23 20:01:41 2024 +0200 +++ b/util/prosodyctl/shell.lua Wed Apr 24 11:45:37 2024 +0100 @@ -83,7 +83,7 @@ for i = 3, #arg do if arg[i]:sub(1, 1) == ":" then table.insert(fmt, i, ")%s("); - elseif i > 3 and fmt[i - 1] == "%q" then + elseif i > 3 and fmt[i - 1]:match("%%q$") then table.insert(fmt, i, ", %q"); else table.insert(fmt, i, "%q");