Changeset

3860:9752a6f1b9f3

mod_rest: Avoid treating special json.null value as any other table
author Kim Alvefur <zash@zash.se>
date Sat, 25 Jan 2020 02:06:07 +0100
parents 3859:da3a0f055526
children 3861:ede3d1724dd1
files mod_rest/jsonmap.lib.lua
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mod_rest/jsonmap.lib.lua	Sat Jan 25 02:03:30 2020 +0100
+++ b/mod_rest/jsonmap.lib.lua	Sat Jan 25 02:06:07 2020 +0100
@@ -77,7 +77,7 @@
 			return { node = s.attr.node, identities = identities, features = features, };
 		end;
 		function  (s)
-			if type(s) == "table" then
+			if type(s) == "table" and s ~= json.null then
 				local disco = st.stanza("query", { xmlns = "http://jabber.org/protocol/disco#info", node = s.node });
 				if s.identities then
 					for _, identity in ipairs(s.identities) do
@@ -107,7 +107,7 @@
 		end;
 		function  (s)
 			local disco = st.stanza("query", { xmlns = "http://jabber.org/protocol/disco#items" });
-			if type(s) == "table" then
+			if type(s) == "table" and s ~= json.null then
 				for _, item in ipairs(s) do
 					if type(item) == "string" then
 						disco:tag("item", { jid = item });