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
commit70ee23c2d60e97a2ba25ab27a2573bbec378eb5b (patch)
tree0a6d3fbcd87936653b66f2cda98bb609445954ba /plugins
parentcf7a0c252addd9f4ccb80883672139b47c7e55a8 (diff)
downloadprosody-70ee23c2d60e97a2ba25ab27a2573bbec378eb5b.tar.gz
prosody-70ee23c2d60e97a2ba25ab27a2573bbec378eb5b.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;