# HG changeset patch # User Kim Alvefur # Date 1688998257 -7200 # Node ID b681948a01f1fa12e841d1b4b6e602565a7c00cd # Parent 7040d07727584ca34d9046a8605fd7bb15cd0f1b mod_http_muc_log: Fix redirect bug If you somehow went to /muc_log/room/yyyy-mm-dd/something it would send you in a redirect loop that continuously added path components until the path can't be parsed anymore. This should ensure that /muc_log/room/date/ is simply 404'd diff -r 7040d0772758 -r b681948a01f1 mod_http_muc_log/mod_http_muc_log.lua --- a/mod_http_muc_log/mod_http_muc_log.lua Mon Jul 10 07:16:54 2023 +0200 +++ b/mod_http_muc_log/mod_http_muc_log.lua Mon Jul 10 16:10:57 2023 +0200 @@ -294,10 +294,16 @@ local function logs_page(event, path) local request, response = event.request, event.response; - local room, date = path:match("^([^/]+)/([^/]*)/?$"); - if not room then + -- /room --> 303 /room/ + -- /room/ --> calendar view + -- /room/yyyy-mm-dd --> logs view + -- /room/yyyy-mm-dd/* --> 404 + local room, date = path:match("^([^/]+)/([^/]*)$"); + if not room and not path:find"/" then response.headers.location = url.build({ path = path .. "/" }); return 303; + elseif not room then + return 404; end room = nodeprep(room); if not room then