# HG changeset patch # User Kim Alvefur # Date 1579914210 -3600 # Node ID da3a0f05552626639fdc5a733639f2448520f1b5 # Parent 29c39876c4afe20f5f64248f18decd8eac913c10 mod_rest: Fix handling of 'node' attribute in disco#info This way also ensures it's covered by type checks in util.stanza diff -r 29c39876c4af -r da3a0f055526 mod_rest/jsonmap.lib.lua --- a/mod_rest/jsonmap.lib.lua Sat Jan 25 01:55:23 2020 +0100 +++ b/mod_rest/jsonmap.lib.lua Sat Jan 25 02:03:30 2020 +0100 @@ -77,9 +77,8 @@ return { node = s.attr.node, identities = identities, features = features, }; end; function (s) - local disco = st.stanza("query", { xmlns = "http://jabber.org/protocol/disco#info" }); if type(s) == "table" then - disco.attr.node = tostring(s.node); + 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 disco:tag("identity", { category = identity.category, type = identity.type, name = identity.name }):up(); @@ -90,8 +89,10 @@ disco:tag("feature", { var = feature }):up(); end end + return disco; + else + st.stanza("query", { xmlns = "http://jabber.org/protocol/disco#info", }); end - return disco; end; };