Mercurial > prosody-modules
diff mod_rest/mod_rest.lua @ 5953:eef6cb08f9e7
mod_rest: Fix to allow underscores in path of HTTP GET to iq-get mapping
A request like
GET /rest/upload_request/{to}
would fail because the pattern would not the underscore in "upload_request"
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Mon, 19 Aug 2024 18:39:22 +0200 |
parents | 667ce80937fa |
children |
line wrap: on
line diff
--- a/mod_rest/mod_rest.lua Sun Aug 11 16:19:37 2024 +0200 +++ b/mod_rest/mod_rest.lua Mon Aug 19 18:39:22 2024 +0200 @@ -149,7 +149,7 @@ -- (table, string) -> table local function amend_from_path(data, path) - local st_kind, st_type, st_to = path:match("^([mpi]%w+)/(%w+)/(.*)$"); + local st_kind, st_type, st_to = path:match("^([mpi]%w+)/([%w_]+)/(.*)$"); if not st_kind then return; end if st_kind == "iq" and st_type ~= "get" and st_type ~= "set" then -- GET /iq/disco/jid