From 29f7b678108f544063a7f50e35841a638e36ca1c Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Thu, 6 Sep 2018 23:51:03 +0200 Subject: mod_vcard_legacy: Return error in case saving avatar fails --- plugins/mod_vcard_legacy.lua | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/plugins/mod_vcard_legacy.lua b/plugins/mod_vcard_legacy.lua index f52306f4..c1d402d3 100644 --- a/plugins/mod_vcard_legacy.lua +++ b/plugins/mod_vcard_legacy.lua @@ -240,8 +240,13 @@ module:hook("iq-set/self/vcard-temp:vCard", function (event) :tag("data", { xmlns="urn:xmpp:avatar:data" }) :text(avatar_payload); - if pep_service:publish("urn:xmpp:avatar:data", origin.full_jid, avatar_hash, avatar_data) then - pep_service:publish("urn:xmpp:avatar:metadata", origin.full_jid, avatar_hash, avatar_meta); + local ok, err = pep_service:publish("urn:xmpp:avatar:data", origin.full_jid, avatar_hash, avatar_data) + if ok then + ok, err = pep_service:publish("urn:xmpp:avatar:metadata", origin.full_jid, avatar_hash, avatar_meta); + end + if not ok then + handle_error(origin, stanza, err); + return true; end end end -- cgit v1.2.3