Mercurial > prosody-modules
diff mod_rest/jsonmap.lib.lua @ 4803:f74c7c518bb2
mod_rest: Handle unknown 'kind' values
Fixes error thrown by util.datamapper if the schema argument is nil
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Thu, 02 Dec 2021 16:08:40 +0100 |
parents | 566e54a07f54 |
children | f69c5a443156 |
line wrap: on
line diff
--- a/mod_rest/jsonmap.lib.lua Sun Nov 28 21:30:53 2021 +0100 +++ b/mod_rest/jsonmap.lib.lua Thu Dec 02 16:08:40 2021 +0100 @@ -499,6 +499,9 @@ elseif kind == "iq" and not t_type then t_type = "get"; end + if not schema.properties[kind or "message"] then + return nil, "unknown-kind"; + end -- XEP-0313 conveninece mapping if kind == "iq" and t_type == "set" and type(t.archive) == "table" and not t.archive.form then