Software /
code /
prosody
Changeset
13418:2374c7665d0b
mod_storage_internal: Fix off-by-one when searching archive for
Fixes a test case provided by MattJ where the very first item matched by
a 'start' timestamp was not returned.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Thu, 15 Feb 2024 20:28:14 +0100 |
parents | 13417:b1e2dd6e735b |
children | 13419:41a587613a0e |
files | plugins/mod_storage_internal.lua |
diffstat | 1 files changed, 2 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/mod_storage_internal.lua Thu Jan 11 07:54:11 2024 +0100 +++ b/plugins/mod_storage_internal.lua Thu Feb 15 20:28:14 2024 +0100 @@ -200,15 +200,11 @@ end if query.start then if not query.reverse then - local wi, exact = binary_search(list, function(item) + local wi = binary_search(list, function(item) local when = item.when or datetime.parse(item.attr.stamp); return query.start - when; end); - if exact then - i = wi - 1; - elseif wi then - i = wi; - end + i = wi - 1; else iter = it.filter(function(item) local when = item.when or datetime.parse(item.attr.stamp);