diff options
author | Kim Alvefur <zash@zash.se> | 2019-03-05 00:12:30 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2019-03-05 00:12:30 +0100 |
commit | cf5c64cd690c92ae7705fe6e7acce2ed81610ec2 (patch) | |
tree | 990e385d87b19bbbe6a66db249fed5e308f88808 /plugins | |
parent | 31db616162d82f7a4dc5f7f496cd95c19cbd5918 (diff) | |
download | prosody-cf5c64cd690c92ae7705fe6e7acce2ed81610ec2.tar.gz prosody-cf5c64cd690c92ae7705fe6e7acce2ed81610ec2.zip |
mod_storage_internal: Return error if 'before' or 'after' are not found (partial fix for #1325)
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/mod_storage_internal.lua | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/plugins/mod_storage_internal.lua b/plugins/mod_storage_internal.lua index 96780b33..fdce3c98 100644 --- a/plugins/mod_storage_internal.lua +++ b/plugins/mod_storage_internal.lua @@ -161,20 +161,30 @@ function archive:find(username, query) if query.reverse then items:reverse(); if query.before then + local found = false; for j = 1, #items do if (items[j].key or tostring(j)) == query.before then + found = true; i = j; break; end end + if not found then + return nil, "item-not-found"; + end end elseif query.after then + local found = false; for j = 1, #items do if (items[j].key or tostring(j)) == query.after then + found = true; i = j; break; end end + if not found then + return nil, "item-not-found"; + end end if query.limit and #items - i > query.limit then items[i+query.limit+1] = nil; |