comparison mod_http_muc_log/mod_http_muc_log.lua @ 4931:13070c6a7ce8

mod_http_muc_log: Fix exception on lack of trailing slash in room path A request to /room leads to the match call returning nil which in turn calls nodeprep(nil). In Prosody 0.11.x this does nothing and simply returns the nil, while in 0.12 it is an error. Now it redirects to the calendar view at /room/ - even for non-existant rooms. Discovered at a deployment with http_paths = { muc_log = "/" } and requests to /robots.txt and similar, which now result in a uses redirect before returning 404.
author Kim Alvefur <zash@zash.se>
date Fri, 22 Apr 2022 14:29:32 +0200
parents 306066898e5f
children 479d618c9e6d
comparison
equal deleted inserted replaced
4930:65438e4ba563 4931:13070c6a7ce8
273 -- Produce the chat log view 273 -- Produce the chat log view
274 local function logs_page(event, path) 274 local function logs_page(event, path)
275 local request, response = event.request, event.response; 275 local request, response = event.request, event.response;
276 276
277 local room, date = path:match("^([^/]+)/([^/]*)/?$"); 277 local room, date = path:match("^([^/]+)/([^/]*)/?$");
278 if not room then
279 response.headers.location = url.build({ path = path .. "/" });
280 return 303;
281 end
278 room = nodeprep(room); 282 room = nodeprep(room);
279 if not room then 283 if not room then
280 return 400; 284 return 400;
281 elseif date == "" then 285 elseif date == "" then
282 return years_page(event, path); 286 return years_page(event, path);