Mercurial > prosody-modules
comparison 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 | a0d77b427d50 |
comparison
equal
deleted
inserted
replaced
| 5952:d60e04d3996e | 5953:eef6cb08f9e7 |
|---|---|
| 147 return false | 147 return false |
| 148 end | 148 end |
| 149 | 149 |
| 150 -- (table, string) -> table | 150 -- (table, string) -> table |
| 151 local function amend_from_path(data, path) | 151 local function amend_from_path(data, path) |
| 152 local st_kind, st_type, st_to = path:match("^([mpi]%w+)/(%w+)/(.*)$"); | 152 local st_kind, st_type, st_to = path:match("^([mpi]%w+)/([%w_]+)/(.*)$"); |
| 153 if not st_kind then return; end | 153 if not st_kind then return; end |
| 154 if st_kind == "iq" and st_type ~= "get" and st_type ~= "set" then | 154 if st_kind == "iq" and st_type ~= "get" and st_type ~= "set" then |
| 155 -- GET /iq/disco/jid | 155 -- GET /iq/disco/jid |
| 156 data = { | 156 data = { |
| 157 kind = "iq"; | 157 kind = "iq"; |
