# HG changeset patch # User Kim Alvefur # Date 1724090921 -7200 # Node ID e5b5a74feb918d34ec4494bcbe9617af644678e0 # Parent eef6cb08f9e7ab5211fcfd92021cb2c0b643cd72 mod_rest: Workaround lack of number coercion in util.datamapper for HTTP upload util.datamapper will not coerce a string into an integer like the XEP-0363 'size' slot, which becomes a problem when using the HTTP GET method, passing fields as ?query parameters which are always strings. diff -r eef6cb08f9e7 -r e5b5a74feb91 mod_rest/jsonmap.lib.lua --- a/mod_rest/jsonmap.lib.lua Mon Aug 19 18:39:22 2024 +0200 +++ b/mod_rest/jsonmap.lib.lua Mon Aug 19 20:08:41 2024 +0200 @@ -550,6 +550,12 @@ t.payload.data = json.encode(t.payload.data); end + if type(t.upload_request) == "table" and type(t.upload_request.size) == "string" then + -- When using GET /rest/upload_request then the arguments from the query are all strings + t.upload_request.size = tonumber(t.upload_request.size); + end + + if kind == "presence" and t.join == true and t.muc == nil then -- COMPAT Older boolean 'join' property used with XEP-0045 t.muc = {};