aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2020-06-01 17:55:01 +0200
committerKim Alvefur <zash@zash.se>2020-06-01 17:55:01 +0200
commita78297bb6c6514d5360339a84f6acc1a94d5198f (patch)
tree89c701102c78086abbf7dcbab641d223f2ac96ae
parentcd40d2a63038338c66c0d7115dfb87ab4b1c6ca6 (diff)
downloadprosody-a78297bb6c6514d5360339a84f6acc1a94d5198f.tar.gz
prosody-a78297bb6c6514d5360339a84f6acc1a94d5198f.zip
mod_vcard_legacy: Fix publishing vcard without avatar
-rw-r--r--plugins/mod_vcard_legacy.lua14
1 files changed, 8 insertions, 6 deletions
diff --git a/plugins/mod_vcard_legacy.lua b/plugins/mod_vcard_legacy.lua
index 3b175df4..92b1d5e9 100644
--- a/plugins/mod_vcard_legacy.lua
+++ b/plugins/mod_vcard_legacy.lua
@@ -276,12 +276,14 @@ function save_to_pep(pep_service, actor, vcard4, avatar)
pep_service:purge("urn:xmpp:avatar:data", actor);
end
- local ok, err = pep_service:publish("urn:xmpp:avatar:data", actor, avatar.hash, avatar.data, node_defaults);
- if ok then
- ok, err = pep_service:publish("urn:xmpp:avatar:metadata", actor, avatar.hash, avatar.meta, node_defaults);
- end
- if not ok then
- return ok, err;
+ if avatar.data and avatar.meta then
+ local ok, err = assert(pep_service:publish("urn:xmpp:avatar:data", actor, avatar.hash, avatar.data, node_defaults));
+ if ok then
+ ok, err = assert(pep_service:publish("urn:xmpp:avatar:metadata", actor, avatar.hash, avatar.meta, node_defaults));
+ end
+ if not ok then
+ return ok, err;
+ end
end
end