Software /
code /
prosody-modules
Comparison
mod_bookmarks/mod_bookmarks.lua @ 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 |
parent | 3487:e60933722248 |
child | 3544:7893115bf382 |
comparison
equal
deleted
inserted
replaced
3542:1bb2a90398d3 | 3543:11629f04ddd0 |
---|---|
30 local username = session.username; | 30 local username = session.username; |
31 local jid = username.."@"..session.host; | 31 local jid = username.."@"..session.host; |
32 local service = mod_pep.get_pep_service(username); | 32 local service = mod_pep.get_pep_service(username); |
33 local ok, id, item = service:get_last_item("storage:bookmarks", session.full_jid); | 33 local ok, id, item = service:get_last_item("storage:bookmarks", session.full_jid); |
34 if not ok then | 34 if not ok then |
35 module:log("error", "Failed to retrieve PEP bookmarks of %s: %s", jid, id); | 35 if id == "item-not-found" then |
36 session.send(st.error_reply(stanza, "cancel", "internal-server-error", "Failed to retrive bookmarks from PEP")); | 36 module:log("debug", "Got no PEP bookmarks item for %s, returning empty private bookmarks", jid); |
37 session.send(st.reply(stanza):add_child(query)); | |
38 else | |
39 module:log("error", "Failed to retrieve PEP bookmarks of %s: %s", jid, id); | |
40 session.send(st.error_reply(stanza, "cancel", "internal-server-error", "Failed to retrive bookmarks from PEP")); | |
41 end | |
37 return; | 42 return; |
38 end | 43 end |
39 if not id or not item then | 44 if not id or not item then |
40 module:log("debug", "Got no PEP bookmarks item for %s, returning empty private bookmarks", jid); | 45 module:log("debug", "Got no PEP bookmarks item for %s, returning empty private bookmarks", jid); |
41 session.send(st.reply(stanza):add_child(query)); | 46 session.send(st.reply(stanza):add_child(query)); |