aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/moduleapi.lua1
-rw-r--r--net/http.lua3
-rw-r--r--plugins/mod_invites.lua2
-rw-r--r--teal-src/util/xtemplate.tl5
-rw-r--r--util/prosodyctl/cert.lua2
-rw-r--r--util/xtemplate.lua3
6 files changed, 12 insertions, 4 deletions
diff --git a/core/moduleapi.lua b/core/moduleapi.lua
index 870a6a50..cbb2da9c 100644
--- a/core/moduleapi.lua
+++ b/core/moduleapi.lua
@@ -558,6 +558,7 @@ end
function api:metric(type_, name, unit, description, label_keys, conf)
local metric = require "core.statsmanager".metric;
local is_scoped = self.host ~= "*"
+ label_keys = label_keys or {};
if is_scoped then
-- prepend `host` label to label keys if this is not a global module
local orig_labels = label_keys
diff --git a/net/http.lua b/net/http.lua
index aa435719..e81975fd 100644
--- a/net/http.lua
+++ b/net/http.lua
@@ -294,6 +294,9 @@ local function request(self, u, ex, callback)
if ex and ex.use_dane ~= nil then
use_dane = ex.use_dane;
end
+ if not sslctx then
+ error("Attempt to make HTTPS request but no 'sslctx' provided in options");
+ end
end
local http_service = basic_resolver.new(host, port_number, "tcp", { servername = req.host; use_dane = use_dane });
diff --git a/plugins/mod_invites.lua b/plugins/mod_invites.lua
index 881b851e..88690f7e 100644
--- a/plugins/mod_invites.lua
+++ b/plugins/mod_invites.lua
@@ -191,7 +191,7 @@ function get(token, username)
type = token_info and token_info.type or "roster";
uri = token_info and token_info.uri or get_uri("roster", username.."@"..module.host, token);
additional_data = token_info and token_info.additional_data or nil;
- reusable = token_info.reusable;
+ reusable = token_info and token_info.reusable or false;
}, valid_invite_mt);
end
diff --git a/teal-src/util/xtemplate.tl b/teal-src/util/xtemplate.tl
index b3bdc400..cdc913bf 100644
--- a/teal-src/util/xtemplate.tl
+++ b/teal-src/util/xtemplate.tl
@@ -46,7 +46,10 @@ local function render(template : string, root : st.stanza_t, escape : escape_t,
if tmpl then tmpl = s_sub(tmpl, 2, -2); end
if args then args = s_sub(args, 2, -2); end
- if func == "each" and tmpl and st.is_stanza(value) then
+ if func == "each" and tmpl then
+ if not st.is_stanza(value) then
+ return "";
+ end
if not args then value, args = root, path; end
local ns, name = s_match(args, "^(%b{})(.*)$");
if ns then ns = s_sub(ns, 2, -2); else name, ns = args, nil; end
diff --git a/util/prosodyctl/cert.lua b/util/prosodyctl/cert.lua
index 02c81585..abd2e1d6 100644
--- a/util/prosodyctl/cert.lua
+++ b/util/prosodyctl/cert.lua
@@ -163,7 +163,7 @@ local function copy(from, to, umask, owner, group)
local attrs = lfs.attributes(to);
if attrs then -- Move old file out of the way
local backup = to..".bkp~"..os.date("%FT%T", attrs.change);
- os.rename(to, backup);
+ assert(os.rename(to, backup));
end
-- FIXME friendlier error handling, maybe move above backup back?
local input = assert(io.open(from));
diff --git a/util/xtemplate.lua b/util/xtemplate.lua
index 254c8af0..88baf1f7 100644
--- a/util/xtemplate.lua
+++ b/util/xtemplate.lua
@@ -31,7 +31,8 @@ local function render(template, root, escape, filters)
if tmpl then tmpl = s_sub(tmpl, 2, -2); end
if args then args = s_sub(args, 2, -2); end
- if func == "each" and tmpl and st.is_stanza(value) then
+ if func == "each" and tmpl then
+ if not st.is_stanza(value) then return "" end
if not args then value, args = root, path; end
local ns, name = s_match(args, "^(%b{})(.*)$");
if ns then