aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_pubsub/pubsub.lib.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2021-11-13 22:12:39 +0100
committerKim Alvefur <zash@zash.se>2021-11-13 22:12:39 +0100
commite08d82a0773a3ef9a32170e9bda191846f0de968 (patch)
tree70cc3a00b4633ff3d28f70f6c0240613cc020f48 /plugins/mod_pubsub/pubsub.lib.lua
parent068388d9c721b38d6a5643c1cdea9b1d5d9b5494 (diff)
downloadprosody-e08d82a0773a3ef9a32170e9bda191846f0de968.tar.gz
prosody-e08d82a0773a3ef9a32170e9bda191846f0de968.zip
mod_pubsub: Fix traceback in disco of non-existent node (thanks Martin)
In this case `ret` is a table not containing the node, which makes pubsub_error_reply() try to get an error template with that `ret` table as index, which returns a `nil` then passed to table.unpack, which in turn throws the error.
Diffstat (limited to 'plugins/mod_pubsub/pubsub.lib.lua')
-rw-r--r--plugins/mod_pubsub/pubsub.lib.lua8
1 files changed, 6 insertions, 2 deletions
diff --git a/plugins/mod_pubsub/pubsub.lib.lua b/plugins/mod_pubsub/pubsub.lib.lua
index 3e29bc10..971a7fd0 100644
--- a/plugins/mod_pubsub/pubsub.lib.lua
+++ b/plugins/mod_pubsub/pubsub.lib.lua
@@ -278,9 +278,13 @@ end
function _M.handle_disco_info_node(event, service)
local stanza, reply, node = event.stanza, event.reply, event.node;
local ok, ret = service:get_nodes(stanza.attr.from);
+ if not ok then
+ event.origin.send(pubsub_error_reply(stanza, ret));
+ return true;
+ end
local node_obj = ret[node];
- if not ok or not node_obj then
- event.origin.send(pubsub_error_reply(stanza, ret or "item-not-found"));
+ if not node_obj then
+ event.origin.send(pubsub_error_reply(stanza, "item-not-found"));
return true;
end
event.exists = true;