# HG changeset patch # User Kim Alvefur # Date 1511034287 -3600 # Node ID 7738d7158dd0ead5dc17f51e66ce35984a0f74bc # Parent 5125e187768f482b34e748ff8834391f9b347293 mod_http_muc_log: Return a 404 page if there are no messages to derive a time span from diff -r 5125e187768f -r 7738d7158dd0 mod_http_muc_log/mod_http_muc_log.lua --- a/mod_http_muc_log/mod_http_muc_log.lua Sat Nov 18 20:42:18 2017 +0100 +++ b/mod_http_muc_log/mod_http_muc_log.lua Sat Nov 18 20:44:47 2017 +0100 @@ -103,11 +103,15 @@ -- Lazy with many false positives local first_day = find_once(room, nil, 3); local last_day = find_once(room, { reverse = true }, 3); - first_day = date_floor(first_day); - last_day = date_floor(last_day); - for when = first_day, last_day, 86400 do - local t = os_date("!*t", when); - dates:set(t.year, t.month, t.day, when); + if first_day and last_day then + first_day = date_floor(first_day); + last_day = date_floor(last_day); + for when = first_day, last_day, 86400 do + local t = os_date("!*t", when); + dates:set(t.year, t.month, t.day, when); + end + else + return; -- 404 end else -- Collect date the hard way