fork of https://f-hub.org/XMPP/xmpp-discord-bridge

avatar: Guard against a non-specified type

+6 -1
+6 -1
xmpp_discord_bridge/avatar.py
··· 20 20 self._logger = logging.getLogger("xmpp.avatar") 21 21 22 22 def _save_avatar(self, jid, data, type_): 23 - self._logger.debug("Got type_ of '%s'", type_) 23 + if not type_: 24 + # TODO: Maybe guess? 25 + self._logger.info("Got VCARD with empty photo type. Assuming image/png") 26 + type_ = "image/png" 27 + 24 28 if len(type_.split("/")) < 2: 29 + self._logger.debug("Got type_ of '%s'", type_) 25 30 self._logger.debug("COMPAT! Just assuming image/png") 26 31 type_ = "image/png" 27 32 filename = hashlib.sha1(data).hexdigest() + "." + type_.split("/")[1]