# HG changeset patch # User Kim Alvefur # Date 1699737999 -3600 # Node ID 66986f5271c3c1a6e084422dac3a609a37617c12 # Parent b4632d5f840b489b6ccf0fd84e9642df1ebf4698 mod_storage_s3: Skip archive items matching on date but not full datetime Since it only encodes dates in paths, it would have returned items from outside the specified start..end range if they were from earlier or later in the same (UTC) day. diff -r b4632d5f840b -r 66986f5271c3 mod_storage_s3/mod_storage_s3.lua --- a/mod_storage_s3/mod_storage_s3.lua Sat Nov 11 17:01:29 2023 +0100 +++ b/mod_storage_s3/mod_storage_s3.lua Sat Nov 11 22:26:39 2023 +0100 @@ -281,7 +281,7 @@ end end local i = 0; - return function() + local function get_next() i = i + 1; local item = keys[i]; if item == nil then @@ -293,10 +293,16 @@ module:log("error", "%s", err); return nil; end - local delay = value:get_child("delay", "urn:xmpp:delay"); + local when = dt.parse(value:get_child_attr("delay", "urn:xmpp:delay", "stamp")); - return item.key, value.tags[2], dt.parse(delay.attr.stamp), item.with; + if (not query["start"] or query["start"] >= when) and (not query["end"] or query["end"] <= when) then + return item.key, value.tags[2], when, item.with; + else + -- date was correct but not the time + return get_next(); + end end + return get_next; end function archive:users()