Mercurial > prosody-modules
changeset 3591:3f8383c5a045
mod_http_muc_log: Fix Y10k bug
Mostly in preparation for the next commit
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Mon, 13 May 2019 00:20:19 +0200 (2019-05-12) |
parents | d8cc8b71a199 |
children | 61a9c087730a |
files | mod_http_muc_log/mod_http_muc_log.lua |
diffstat | 1 files changed, 7 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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, {