Changeset

11882:c3bd71227e17

mod_pubsub: Return proper errors for disco queries on nodes Previously this would return item-not-found, even when you could see the node in disco#items.
author Kim Alvefur <zash@zash.se>
date Mon, 01 Nov 2021 17:59:46 +0100
parents 11881:2138fc13d53a
children 11883:97aa4b2fe4e0
files plugins/mod_pubsub/pubsub.lib.lua
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_pubsub/pubsub.lib.lua	Thu Oct 28 13:02:59 2021 +0200
+++ b/plugins/mod_pubsub/pubsub.lib.lua	Mon Nov 01 17:59:46 2021 +0100
@@ -280,7 +280,8 @@
 	local ok, ret = service:get_nodes(stanza.attr.from);
 	local node_obj = ret[node];
 	if not ok or not node_obj then
-		return;
+		event.origin.send(pubsub_error_reply(stanza, ret or "item-not-found"));
+		return true;
 	end
 	event.exists = true;
 	reply:tag("identity", { category = "pubsub", type = "leaf" }):up();
@@ -299,7 +300,8 @@
 	local stanza, reply, node = event.stanza, event.reply, event.node;
 	local ok, ret = service:get_items(node, stanza.attr.from);
 	if not ok then
-		return;
+		event.origin.send(pubsub_error_reply(stanza, ret));
+		return true;
 	end
 
 	for _, id in ipairs(ret) do