diff options
author | Kim Alvefur <zash@zash.se> | 2018-10-21 18:00:46 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2018-10-21 18:00:46 +0200 |
commit | 70ee23c2d60e97a2ba25ab27a2573bbec378eb5b (patch) | |
tree | 0a6d3fbcd87936653b66f2cda98bb609445954ba | |
parent | cf7a0c252addd9f4ccb80883672139b47c7e55a8 (diff) | |
download | prosody-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.
-rw-r--r-- | plugins/mod_storage_memory.lua | 2 |
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; |