comparison mod_storage_xmlarchive/mod_storage_xmlarchive.lua @ 6546:8a4e6421fd24

mod_storage_xmlarchive: Remove unnecessary percent-encoding of paths Paths from lfs.dir() are already in the percent-encoded form. Probably confusion left over since before 1b081c8fc1d9
author Kim Alvefur <zash@zash.se>
date Sun, 24 May 2026 19:17:22 +0200
parents 3b605bfc94aa
children
comparison
equal deleted inserted replaced
6545:3b605bfc94aa 6546:8a4e6421fd24
455 end 455 end
456 456
457 function provider:purge(username) 457 function provider:purge(username)
458 local encoded_username = dm.path_encode((username or "@") .. "@"); 458 local encoded_username = dm.path_encode((username or "@") .. "@");
459 local basepath = prosody.paths.data .. "/" .. dm.path_encode(module.host); 459 local basepath = prosody.paths.data .. "/" .. dm.path_encode(module.host);
460 for rawstore in lfs.dir(basepath) do 460 for store in lfs.dir(basepath) do
461 local encoded_store = basepath .. "/" .. dm.path_encode(rawstore); 461 local store_path = basepath .. "/" .. store;
462 if lfs.attributes(encoded_store, "mode") == "directory" then 462 if lfs.attributes(store_path, "mode") == "directory" then
463 for file in lfs.dir(encoded_store) do 463 for file in lfs.dir(store_path) do
464 if file:sub(1, #encoded_username) == encoded_username then 464 if file:sub(1, #encoded_username) == encoded_username then
465 if file:sub(-4) == ".xml" or file:sub(-5) == ".list" or file:sub(-5) == ".lidx" then 465 if file:sub(-4) == ".xml" or file:sub(-5) == ".list" or file:sub(-5) == ".lidx" then
466 os.remove(encoded_store .. "/" .. file); 466 os.remove(store_path .. "/" .. file);
467 end 467 end
468 end 468 end
469 end 469 end
470 end 470 end
471 end 471 end