25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-22 17:28:25 +01:00

mod_private: Cope with bookmark decoding errors

Handle invalid XEP-0048 bookmarks gracefully while attempting to publish
them to an XEP-0402 node.
This commit is contained in:
Holger Weiss 2024-05-28 21:07:04 +02:00
parent 52abe8016b
commit 7ba9f2e4e8

View File

@ -328,9 +328,13 @@ publish_pep_native_bookmarks(JID, Data) ->
true ->
case lists:keyfind(?NS_STORAGE_BOOKMARKS, 1, Data) of
{_, Bookmarks0} ->
Bookmarks = case xmpp:decode(Bookmarks0) of
Bookmarks = try xmpp:decode(Bookmarks0) of
#bookmark_storage{conference = C} -> C;
_ -> []
catch _:{xmpp_codec, Why} ->
?WARNING_MSG("Failed to decode bookmarks of ~ts: ~ts",
[jid:encode(JID), xmpp:format_error(Why)]),
[]
end,
PubOpts = [{persist_items, true}, {access_model, whitelist}, {max_items, max}, {notify_retract,true}, {notify_delete,true}, {send_last_published_item, never}],
case mod_pubsub:get_items(LBJID, ?NS_PEP_BOOKMARKS) of