diff options
author | mpeterv <mpeterval@gmail.com> | 2015-03-18 09:50:17 +0300 |
---|---|---|
committer | mpeterv <mpeterval@gmail.com> | 2015-03-18 09:50:17 +0300 |
commit | df332f6c2ba64aea16bebf37d4f96092a462713c (patch) | |
tree | 858216c1982718fbcb947166d19dff81bf15b272 /src | |
parent | 88a903a50bd0e581b8886004402d41f44d2255e1 (diff) | |
download | luarocks-df332f6c2ba64aea16bebf37d4f96092a462713c.tar.gz luarocks-df332f6c2ba64aea16bebf37d4f96092a462713c.tar.bz2 luarocks-df332f6c2ba64aea16bebf37d4f96092a462713c.zip |
Fix url redacting when Luasocket is used
Move definition of redact_api_url up so that it is visible in both
Luasocket and Luasocket-less versions of Api:request
Diffstat (limited to 'src')
-rw-r--r-- | src/luarocks/upload/api.lua | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/luarocks/upload/api.lua b/src/luarocks/upload/api.lua index 6dfb98df..3ab271ad 100644 --- a/src/luarocks/upload/api.lua +++ b/src/luarocks/upload/api.lua | |||
@@ -116,14 +116,14 @@ local function require_json() | |||
116 | return nil | 116 | return nil |
117 | end | 117 | end |
118 | 118 | ||
119 | local ltn12_ok, ltn12 = pcall(require, "ltn12") | ||
120 | if not ltn12_ok then -- If not using LuaSocket and/or LuaSec... | ||
121 | |||
122 | local function redact_api_url(url) | 119 | local function redact_api_url(url) |
123 | url = tostring(url) | 120 | url = tostring(url) |
124 | return (url:gsub(".*/api/[^/]+/[^/]+", "")) or "" | 121 | return (url:gsub(".*/api/[^/]+/[^/]+", "")) or "" |
125 | end | 122 | end |
126 | 123 | ||
124 | local ltn12_ok, ltn12 = pcall(require, "ltn12") | ||
125 | if not ltn12_ok then -- If not using LuaSocket and/or LuaSec... | ||
126 | |||
127 | function Api:request(url, params, post_params) | 127 | function Api:request(url, params, post_params) |
128 | local vars = cfg.variables | 128 | local vars = cfg.variables |
129 | local json_ok, json = require_json() | 129 | local json_ok, json = require_json() |