Software /
code /
prosody
Comparison
plugins/mod_pubsub/pubsub.lib.lua @ 11904:313d01cc4258
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.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 13 Nov 2021 22:12:39 +0100 |
parent | 11882:c3bd71227e17 |
child | 12021:376522fb3f52 |
comparison
equal
deleted
inserted
replaced
11903:baf69f254753 | 11904:313d01cc4258 |
---|---|
276 end | 276 end |
277 | 277 |
278 function _M.handle_disco_info_node(event, service) | 278 function _M.handle_disco_info_node(event, service) |
279 local stanza, reply, node = event.stanza, event.reply, event.node; | 279 local stanza, reply, node = event.stanza, event.reply, event.node; |
280 local ok, ret = service:get_nodes(stanza.attr.from); | 280 local ok, ret = service:get_nodes(stanza.attr.from); |
281 if not ok then | |
282 event.origin.send(pubsub_error_reply(stanza, ret)); | |
283 return true; | |
284 end | |
281 local node_obj = ret[node]; | 285 local node_obj = ret[node]; |
282 if not ok or not node_obj then | 286 if not node_obj then |
283 event.origin.send(pubsub_error_reply(stanza, ret or "item-not-found")); | 287 event.origin.send(pubsub_error_reply(stanza, "item-not-found")); |
284 return true; | 288 return true; |
285 end | 289 end |
286 event.exists = true; | 290 event.exists = true; |
287 reply:tag("identity", { category = "pubsub", type = "leaf" }):up(); | 291 reply:tag("identity", { category = "pubsub", type = "leaf" }):up(); |
288 if node_obj.config then | 292 if node_obj.config then |