changeset 3245:1d57f485efef

mod_profile: Use type property over content identifiguesstimation
author Kim Alvefur <zash@zash.se>
date Mon, 20 Aug 2018 21:20:53 +0200 (2018-08-20)
parents 2b888a7aa21c
children 2a54b331f011
files mod_profile/mod_profile.lua
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mod_profile/mod_profile.lua	Mon Aug 20 20:22:43 2018 +0200
+++ b/mod_profile/mod_profile.lua	Mon Aug 20 21:20:53 2018 +0200
@@ -74,13 +74,14 @@
 	if photo and photo[1] then
 		local photo_raw = base64.decode(photo[1]);
 		local photo_hash = sha1(photo_raw, true);
+		local photo_type = photo.TYPE and photo.TYPE[1];
 
 		pep:publish("urn:xmpp:avatar:metadata", true, item_container(photo_hash,
 			st.stanza("metadata", { xmlns="urn:xmpp:avatar:metadata" })
 				:tag("info", {
 					bytes = tostring(#photo_raw),
 					id = photo_hash,
-					type = identify(photo_raw),
+					type = photo_type or identify(photo_raw),
 				})));
 		pep:publish("urn:xmpp:avatar:data", true, item_container(photo_hash,
 			st.stanza("data", { xmlns="urn:xmpp:avatar:data" }):text(photo[1])));