# HG changeset patch # User Emmanuel Gil Peyrot # Date 1535386468 -7200 # Node ID 87769f53fdc8b10e294c089dd5ea3c83d06d46e4 # Parent f2037a754480b2a2e2d29018db26ef9eae582b5e mod_bookmarks: Delete the node before attempting migration, to make sure its config is correct. diff -r f2037a754480 -r 87769f53fdc8 mod_bookmarks/mod_bookmarks.lua --- a/mod_bookmarks/mod_bookmarks.lua Sat Aug 25 20:10:21 2018 +0200 +++ b/mod_bookmarks/mod_bookmarks.lua Mon Aug 27 18:14:28 2018 +0200 @@ -83,12 +83,12 @@ local function on_resource_bind(event) local session = event.session; local username = session.username; + local service = mod_pep.get_pep_service(username); local jid = username.."@"..session.host; local data, err = private_storage:get(username, "storage:storage:bookmarks"); if not data then module:log("debug", "No existing Private XML bookmarks for %s, migration already done: %s", jid, err); - local service = mod_pep.get_pep_service(username); local ok, id = service:get_last_item("storage:bookmarks", session.full_jid); if not ok or not id then module:log("debug", "Additionally, no PEP bookmarks were existing for %s", jid); @@ -99,6 +99,10 @@ local bookmarks = st.deserialize(data); module:log("debug", "Got private bookmarks of %s: %s", jid, bookmarks); + -- We don’t care if deleting succeeds or not, we only want to start with a non-existent node. + module:log("debug", "Deleting possibly existing PEP item for %s", jid); + service:delete("storage:bookmarks", jid); + module:log("debug", "Going to store PEP item for %s", jid); local ok, err = publish_to_pep(session.full_jid, bookmarks); if not ok then