Software /
code /
prosody-modules
Comparison
mod_rest/jsonmap.lib.lua @ 4372:78de3c7acf58
mod_rest: Fix json-mapping stanzas with text or whitespace between tags
Test:
jsonmap.st2json( st.message({}, "hi"):indent() )
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 22 Jan 2021 15:19:53 +0100 |
parent | 4309:e8b9228b5265 |
child | 4473:3b50a9a75fb6 |
comparison
equal
deleted
inserted
replaced
4371:3d01bc4547b2 | 4372:78de3c7acf58 |
---|---|
484 by = error and error.attr.by or nil, | 484 by = error and error.attr.by or nil, |
485 }; | 485 }; |
486 return t; | 486 return t; |
487 end | 487 end |
488 | 488 |
489 for tag in s:children() do | 489 for _, tag in ipairs(s.tags) do |
490 local prefix = "{" .. (tag.attr.xmlns or "jabber:client") .. "}"; | 490 local prefix = "{" .. (tag.attr.xmlns or "jabber:client") .. "}"; |
491 local mapping = byxmlname[prefix .. tag.name]; | 491 local mapping = byxmlname[prefix .. tag.name]; |
492 if not mapping then | 492 if not mapping then |
493 mapping = byxmlname[prefix]; | 493 mapping = byxmlname[prefix]; |
494 end | 494 end |