Software /
code /
prosody-modules
Changeset
3543:11629f04ddd0
mod_bookmarks: Check for item-not-found and return empty Private XML. Fixes #1265 (thanks gerald and thebigfrog!)
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Tue, 02 Apr 2019 16:22:40 +0200 |
parents | 3542:1bb2a90398d3 |
children | 3544:7893115bf382 |
files | mod_bookmarks/mod_bookmarks.lua |
diffstat | 1 files changed, 7 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/mod_bookmarks/mod_bookmarks.lua Tue Apr 02 16:27:14 2019 +0200 +++ b/mod_bookmarks/mod_bookmarks.lua Tue Apr 02 16:22:40 2019 +0200 @@ -32,8 +32,13 @@ local service = mod_pep.get_pep_service(username); local ok, id, item = service:get_last_item("storage:bookmarks", session.full_jid); if not ok then - module:log("error", "Failed to retrieve PEP bookmarks of %s: %s", jid, id); - session.send(st.error_reply(stanza, "cancel", "internal-server-error", "Failed to retrive bookmarks from PEP")); + if id == "item-not-found" then + module:log("debug", "Got no PEP bookmarks item for %s, returning empty private bookmarks", jid); + session.send(st.reply(stanza):add_child(query)); + else + module:log("error", "Failed to retrieve PEP bookmarks of %s: %s", jid, id); + session.send(st.error_reply(stanza, "cancel", "internal-server-error", "Failed to retrive bookmarks from PEP")); + end return; end if not id or not item then