# HG changeset patch # User Kim Alvefur # Date 1557699619 -7200 # Node ID 3f8383c5a045817441c87c824fa6c50fb6d138a0 # Parent d8cc8b71a1999c4ac09bc7109478fc31397b6173 mod_http_muc_log: Fix Y10k bug Mostly in preparation for the next commit diff -r d8cc8b71a199 -r 3f8383c5a045 mod_http_muc_log/mod_http_muc_log.lua --- a/mod_http_muc_log/mod_http_muc_log.lua Wed May 08 13:51:49 2019 +0200 +++ b/mod_http_muc_log/mod_http_muc_log.lua Mon May 13 00:20:19 2019 +0200 @@ -230,11 +230,11 @@ local function logs_page(event, path) local request, response = event.request, event.response; - -- FIXME In the year, 105105, if MUC is still alive, - -- if Prosody can survive... Enjoy this Y10k bug - local room, date = path:match("^(.-)/(%d%d%d%d%-%d%d%-%d%d)/?$"); + local room, date = path:match("^([^/]+)/([^/]*)/?$"); room = nodeprep(room); if not room then + return 400; + elseif date == "" then return years_page(event, path); end local is_open = open_room(room); @@ -244,6 +244,10 @@ return 403; end local day_start = datetime.parse(date.."T00:00:00Z"); + if not day_start then + module:log("debug", "Invalid date format: %q", date); + return 400; + end local logs, i = {}, 1; local iter, err = archive:find(room, {