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
commit534dae716450dbb1cfbdaa9abb407bec2e68b26b (patch)
tree0a6d3fbcd87936653b66f2cda98bb609445954ba /plugins
parent03151ec6d54ec9cc53b917fdbe80a492a489b0f6 (diff)
downloadprosody-534dae716450dbb1cfbdaa9abb407bec2e68b26b.tar.gz
prosody-534dae716450dbb1cfbdaa9abb407bec2e68b26b.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;