aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2018-10-21 18:00:46 +0200
committerKim Alvefur <zash@zash.se>2018-10-21 18:00:46 +0200
commit963677964137c7041942ce0a83b8aa48993c0c37 (patch)
tree0a6d3fbcd87936653b66f2cda98bb609445954ba /plugins
parent9902388da51adb2435012a64fe06757d4cef97b9 (diff)
downloadprosody-963677964137c7041942ce0a83b8aa48993c0c37.tar.gz
prosody-963677964137c7041942ce0a83b8aa48993c0c37.zip
mod_storage_memory: Fix overwriting old keys
Test fixed is: spec/core_storagemanager_spec.lua:309: Expected objects to be equal.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mod_storage_memory.lua2
1 files changed, 1 insertions, 1 deletions
diff --git a/plugins/mod_storage_memory.lua b/plugins/mod_storage_memory.lua
index 20135d86..cbbc5e29 100644
--- a/plugins/mod_storage_memory.lua
+++ b/plugins/mod_storage_memory.lua
@@ -53,7 +53,6 @@ function archive_store:append(username, key, value, when, with)
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 @@ function archive_store:append(username, key, value, when, with)
if a[key] then
table.remove(a, a[key]);
end
+ local i = #a+1;
a[i] = v;
a[key] = i;
return key;