comparison 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
comparison
equal deleted inserted replaced
4802:75543146e94e 4803:f74c7c518bb2
497 if kind == "presence" and t_type == "available" then 497 if kind == "presence" and t_type == "available" then
498 t_type = nil; 498 t_type = nil;
499 elseif kind == "iq" and not t_type then 499 elseif kind == "iq" and not t_type then
500 t_type = "get"; 500 t_type = "get";
501 end 501 end
502 if not schema.properties[kind or "message"] then
503 return nil, "unknown-kind";
504 end
502 505
503 -- XEP-0313 conveninece mapping 506 -- XEP-0313 conveninece mapping
504 if kind == "iq" and t_type == "set" and type(t.archive) == "table" and not t.archive.form then 507 if kind == "iq" and t_type == "set" and type(t.archive) == "table" and not t.archive.form then
505 local archive = t.archive; 508 local archive = t.archive;
506 if archive["with"] or archive["start"] or archive["end"] or archive["before-id"] or archive["after-id"] 509 if archive["with"] or archive["start"] or archive["end"] or archive["before-id"] or archive["after-id"]