Changeset

3793:0d3926e49b55

mod_pubsub_post: Fix use of 'id' field in JSON object as pubsub item id `data` here is the source string, so there's no `id` field. Also only use the `id` field if it's a string.
author Kim Alvefur <zash@zash.se>
date Wed, 01 Jan 2020 10:11:08 +0100
parents 3792:aec772bbd558
children 3794:4b258329e6e4
files mod_pubsub_post/mod_pubsub_post.lua
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mod_pubsub_post/mod_pubsub_post.lua	Mon Dec 30 22:44:12 2019 +0100
+++ b/mod_pubsub_post/mod_pubsub_post.lua	Wed Jan 01 10:11:08 2020 +0100
@@ -43,7 +43,7 @@
 		return { status_code = 400; body = "object or array expected"; };
 	end
 	local wrapper = st.stanza("json", { xmlns="urn:xmpp:json:0" }):text(data);
-	return publish_payload(node, actor, data.id or "current", wrapper);
+	return publish_payload(node, actor, type(parsed.id) == "string" and parsed.id or "current", wrapper);
 end
 
 local function publish_atom(node, actor, feed)