aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2020-07-09 14:49:22 -0300
committerHisham Muhammad <hisham@gobolinux.org>2020-07-09 14:49:22 -0300
commit0953c89d2c73b8cfd59b470b2da3b7a04a654269 (patch)
treec5dd6a61d146ab5104fcbaff2c0bd83477ff6686
parentc52a5c57ccffa5a0929593cd94fa5f87e795efd7 (diff)
downloadluarocks-0953c89d2c73b8cfd59b470b2da3b7a04a654269.tar.gz
luarocks-0953c89d2c73b8cfd59b470b2da3b7a04a654269.tar.bz2
luarocks-0953c89d2c73b8cfd59b470b2da3b7a04a654269.zip
Escape % when feeding it to second arg of string.gsub
Fixes #1200
-rw-r--r--src/luarocks/cmd/show.lua3
1 files changed, 3 insertions, 0 deletions
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)
149 local n = cmd == "*" and #d or 1 149 local n = cmd == "*" and #d or 1
150 for i = 1, n do 150 for i = 1, n do
151 local tbl = cmd == "*" and d[i] or data 151 local tbl = cmd == "*" and d[i] or data
152 if type(tbl) == "string" then
153 tbl = tbl:gsub("%%", "%%%%")
154 end
152 table.insert(out, (line:gsub("${([a-z]+)}", tbl))) 155 table.insert(out, (line:gsub("${([a-z]+)}", tbl)))
153 end 156 end
154 end 157 end