changeset 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 d60e04d3996e
children e5b5a74feb91
files mod_rest/mod_rest.lua
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
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