From 8649a4e18181ec342890a041f5ba9625b0d481d4 Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Tue, 17 Mar 2015 15:51:28 -0300 Subject: Release LuaRocks 2.2.1 --- src/luarocks/cfg.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/luarocks/cfg.lua b/src/luarocks/cfg.lua index 50d247b5..c264e67b 100644 --- a/src/luarocks/cfg.lua +++ b/src/luarocks/cfg.lua @@ -34,7 +34,7 @@ end cfg.site_config = site_config -cfg.program_version = "scm" +cfg.program_version = "2.2.1" cfg.program_series = "2.2" cfg.major_version = (cfg.program_version:match("([^.]%.[^.])")) or cfg.program_series -- cgit v1.2.3-55-g6feb From 650c8ae9e8096bbb8f70ad8e0764e91d47dfae86 Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Tue, 17 Mar 2015 15:54:06 -0300 Subject: Back to our regularly scheduled programming --- rockspec | 2 +- src/luarocks/cfg.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/rockspec b/rockspec index 286564e7..92237c0c 100644 --- a/rockspec +++ b/rockspec @@ -1,5 +1,5 @@ package = "LuaRocks" -local VER = "2.2.1" +local VER = "scm" local REV = "1" version = VER.."-"..REV diff --git a/src/luarocks/cfg.lua b/src/luarocks/cfg.lua index c264e67b..50d247b5 100644 --- a/src/luarocks/cfg.lua +++ b/src/luarocks/cfg.lua @@ -34,7 +34,7 @@ end cfg.site_config = site_config -cfg.program_version = "2.2.1" +cfg.program_version = "scm" cfg.program_series = "2.2" cfg.major_version = (cfg.program_version:match("([^.]%.[^.])")) or cfg.program_series -- cgit v1.2.3-55-g6feb From 4347dc7ab33ea4c6657578d234fd986bbfb4e3bc Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Tue, 17 Mar 2015 19:37:33 -0300 Subject: Redact API URL to hide API key. Problem pointed out by @ignacio in #273. --- src/luarocks/upload/api.lua | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/luarocks/upload/api.lua b/src/luarocks/upload/api.lua index fd476968..ec6ef3bb 100644 --- a/src/luarocks/upload/api.lua +++ b/src/luarocks/upload/api.lua @@ -119,6 +119,11 @@ end local ltn12_ok, ltn12 = pcall(require, "ltn12") if not ltn12_ok then -- If not using LuaSocket and/or LuaSec... +local function redact_api_url(url) + url = tostring(url) + return (url:gsub(".*/api/[^/]+/[^/]+", "")) +end + function Api:request(url, params, post_params) local vars = cfg.variables local json_ok, json = require_json() @@ -157,26 +162,26 @@ function Api:request(url, params, post_params) end local ok = fs.execute_string(curl_cmd..fs.Q(url).." -o "..fs.Q(tmpfile)) if not ok then - return nil, "API failure: " .. tostring(url) + return nil, "API failure: " .. redact_api_url(url) end else local ok, err = fs.download(url, tmpfile) if not ok then - return nil, "API failure: " .. tostring(err) .. " - " .. tostring(url) + return nil, "API failure: " .. tostring(err) .. " - " .. redact_api_url(url) end end local tmpfd = io.open(tmpfile) if not tmpfd then os.remove(tmpfile) - return nil, "API failure reading temporary file - " .. tostring(url) + return nil, "API failure reading temporary file - " .. redact_api_url(url) end out = tmpfd:read("*a") tmpfd:close() os.remove(tmpfile) if self.debug then - util.printout("[" .. tostring(method) .. " via curl] " .. tostring(url) .. " ... ") + util.printout("[" .. tostring(method) .. " via curl] " .. redact_api_url(url) .. " ... ") end return json.decode(out) @@ -229,7 +234,7 @@ function Api:request(url, params, post_params) end local method = post_params and "POST" or "GET" if self.debug then - util.printout("[" .. tostring(method) .. " via "..via.."] " .. tostring(url) .. " ... ") + util.printout("[" .. tostring(method) .. " via "..via.."] " .. redact_api_url(url) .. " ... ") end local out = {} local _, status = http.request({ @@ -243,7 +248,7 @@ function Api:request(url, params, post_params) util.printout(tostring(status)) end if status ~= 200 then - return nil, "API returned " .. tostring(status) .. " - " .. tostring(url) + return nil, "API returned " .. tostring(status) .. " - " .. redact_api_url(url) end return json.decode(table.concat(out)) end -- cgit v1.2.3-55-g6feb From dc5f2009eaf765a21c6ea285b5ad3f45b17e5752 Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Tue, 17 Mar 2015 19:39:22 -0300 Subject: Make it a bit more robust. --- src/luarocks/upload/api.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/luarocks/upload/api.lua b/src/luarocks/upload/api.lua index ec6ef3bb..6dfb98df 100644 --- a/src/luarocks/upload/api.lua +++ b/src/luarocks/upload/api.lua @@ -121,7 +121,7 @@ if not ltn12_ok then -- If not using LuaSocket and/or LuaSec... local function redact_api_url(url) url = tostring(url) - return (url:gsub(".*/api/[^/]+/[^/]+", "")) + return (url:gsub(".*/api/[^/]+/[^/]+", "")) or "" end function Api:request(url, params, post_params) -- cgit v1.2.3-55-g6feb