# HG changeset patch # User Kim Alvefur # Date 1548094669 -3600 # Node ID 0c539092aa75a915b82a8af561fbaa7ea5c0cb59 # Parent 7b97abf26612aaa6031c33ad9b5769d54b116897 mod_storage_xmlarchive: Allow lookup of IDs that don't follow the YYYY-MM-DD-RANDOM format E.g. for converted archives where the IDs are preserved. This will be expensive. diff -r 7b97abf26612 -r 0c539092aa75 mod_storage_xmlarchive/mod_storage_xmlarchive.lua --- a/mod_storage_xmlarchive/mod_storage_xmlarchive.lua Sun Jan 20 18:18:02 2019 +0100 +++ b/mod_storage_xmlarchive/mod_storage_xmlarchive.lua Mon Jan 21 19:17:49 2019 +0100 @@ -59,9 +59,9 @@ function archive:_get_idx(username, id, dates) module:log("debug", "Looking for item with id %q", id); dates = dates or self:dates(username) or empty; - local date = id:sub(1, 10); + local date = id:match("^%d%d%d%d%-%d%d%-%d%d"); for d = 1, #dates do - if date == dates[d] then + if not date or date == dates[d] then module:log("debug", "Loading index for %s", dates[d]); local items = dm.list_load(username .. "@" .. dates[d], self.host, self.store) or empty; for i = 1, #items do @@ -70,7 +70,7 @@ end end return; -- Assuming no duplicates - elseif date < dates[d] then + elseif date and date < dates[d] then return; -- List is assumed to be sorted end end