Software /
code /
prosody
Changeset
9534:b301f7edf346
mod_storage_memory: Fix overwriting old keys
Test fixed is: spec/core_storagemanager_spec.lua:309: Expected objects to be equal.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 21 Oct 2018 18:00:46 +0200 |
parents | 9533:00a8e627854e |
children | 9535:c1befd1c886d |
files | plugins/mod_storage_memory.lua |
diffstat | 1 files changed, 1 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/mod_storage_memory.lua Sun Oct 21 17:58:50 2018 +0200 +++ b/plugins/mod_storage_memory.lua Sun Oct 21 18:00:46 2018 +0200 @@ -53,7 +53,6 @@ a = {}; self.store[username or NULL] = a; end - local i = #a+1; local v = { key = key, when = when, with = with, value = value }; if not key then key = tostring(a):match"%x+$"..tostring(v):match"%x+$"; @@ -62,6 +61,7 @@ if a[key] then table.remove(a, a[key]); end + local i = #a+1; a[i] = v; a[key] = i; return key;