tangled
alpha
login
or
join now
zenfyr.dev
/
xmpp-discord-bridge
0
fork
atom
fork of https://f-hub.org/XMPP/xmpp-discord-bridge
0
fork
atom
overview
issues
pulls
pipelines
avatar: Guard against a non-specified type
Alexander PapaTutuWawa
4 years ago
40fcd404
3d3686c3
+6
-1
1 changed file
expand all
collapse all
unified
split
xmpp_discord_bridge
avatar.py
+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
23
-
self._logger.debug("Got type_ of '%s'", type_)
23
23
+
if not type_:
24
24
+
# TODO: Maybe guess?
25
25
+
self._logger.info("Got VCARD with empty photo type. Assuming image/png")
26
26
+
type_ = "image/png"
27
27
+
24
28
if len(type_.split("/")) < 2:
29
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]