# HG changeset patch # User Kim Alvefur # Date 1775589054 -7200 # Node ID 5fb466693e8583e1eaf5bc3e218f712e59cce3f2 # Parent f6c83a8425f2c6aefa80aa800afe93683ef6766c mod_storage_xmlarchive: Ensure list index files are removed using os.remove() on the list files leaves the new index files behind since util.datamanager does not know they are removed. Thanks Link Mauve diff -r f6c83a8425f2 -r 5fb466693e85 mod_storage_xmlarchive/mod_storage_xmlarchive.lua --- a/mod_storage_xmlarchive/mod_storage_xmlarchive.lua Tue Apr 07 21:09:00 2026 +0200 +++ b/mod_storage_xmlarchive/mod_storage_xmlarchive.lua Tue Apr 07 21:10:54 2026 +0200 @@ -423,7 +423,7 @@ if not ok then return ok, err; end for d = 1, #dates do if dates[d] < before then - os.remove(dm.getpath(username .. "@" .. dates[d], self.host, self.store, "list")); + dm.list_store(username .. "@" .. dates[d], self.host, self.store, empty); os.remove(dm.getpath(username .. "@" .. dates[d], self.host, self.store, "xml")); end end @@ -457,13 +457,13 @@ function provider:purge(username) local encoded_username = dm.path_encode((username or "@") .. "@"); local basepath = prosody.paths.data .. "/" .. dm.path_encode(module.host); - for store in lfs.dir(basepath) do - local store = basepath .. "/" .. dm.path_encode(store); - if lfs.attributes(store, "mode") == "directory" then - for file in lfs.dir(store) do + for rawstore in lfs.dir(basepath) do + local encoded_store = basepath .. "/" .. dm.path_encode(rawstore); + if lfs.attributes(encoded_store, "mode") == "directory" then + for file in lfs.dir(encoded_store) do if file:sub(1, #encoded_username) == encoded_username then - if file:sub(-4) == ".xml" or file:sub(-5) == ".list" then - os.remove(store .. "/" .. file); + if file:sub(-4) == ".xml" or file:sub(-5) == ".list" or file:sub(-5) == ".lidx" then + os.remove(encoded_store .. "/" .. file); end end end