From 0953c89d2c73b8cfd59b470b2da3b7a04a654269 Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Thu, 9 Jul 2020 14:49:22 -0300 Subject: Escape % when feeding it to second arg of string.gsub Fixes #1200 --- src/luarocks/cmd/show.lua | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/luarocks/cmd/show.lua b/src/luarocks/cmd/show.lua index 6d8047d5..c5188538 100644 --- a/src/luarocks/cmd/show.lua +++ b/src/luarocks/cmd/show.lua @@ -149,6 +149,9 @@ local function render(template, data) local n = cmd == "*" and #d or 1 for i = 1, n do local tbl = cmd == "*" and d[i] or data + if type(tbl) == "string" then + tbl = tbl:gsub("%%", "%%%%") + end table.insert(out, (line:gsub("${([a-z]+)}", tbl))) end end -- cgit v1.2.3-55-g6feb