Changeset

9207:76d593b35958

util.pubsub, pubsub.lib: Improve error on attempt to publish invalid item
author Matthew Wild <mwild1@gmail.com>
date Sat, 18 Aug 2018 15:26:35 +0100
parents 9206:33ee40dc3e25
children 9208:d3bb59ec0173
files plugins/mod_pubsub/pubsub.lib.lua util/pubsub.lua
diffstat 2 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_pubsub/pubsub.lib.lua	Sat Aug 18 15:10:41 2018 +0100
+++ b/plugins/mod_pubsub/pubsub.lib.lua	Sat Aug 18 15:26:35 2018 +0100
@@ -30,6 +30,7 @@
 	["not-acceptable"] = { "modify", "not-acceptable" };
 	["internal-server-error"] = { "wait", "internal-server-error" };
 	["precondition-not-met"] = { "cancel", "conflict", nil, "precondition-not-met" };
+	["invalid-item"] = { "modify", "bad-request", "invalid item" };
 };
 local function pubsub_error_reply(stanza, error)
 	local e = pubsub_errors[error];
--- a/util/pubsub.lua	Sat Aug 18 15:10:41 2018 +0100
+++ b/util/pubsub.lua	Sat Aug 18 15:26:35 2018 +0100
@@ -509,7 +509,7 @@
 		return false, "precondition-not-met";
 	end
 	if not self.config.itemcheck(item) then
-		return nil, "internal-server-error";
+		return nil, "invalid-item";
 	end
 	local node_data = self.data[node];
 	local ok = node_data:set(id, item);