summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Bottomley <James.Bottomley@HansenPartnership.com>2018-12-09 15:30:17 -0800
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2018-12-09 15:30:17 -0800
commit78f8fbb99381a55a3753a5df2f60506103e98085 (patch)
tree396fbd8cd3c2dda47c4d18d5a72d6e107443cbb3
parentb6cf412d7ba723c90ceb653e802ca7c75a7928c2 (diff)
downloadhangouts-xmpp-gateway-78f8fbb99381a55a3753a5df2f60506103e98085.tar.gz
xmppthread: fix photo url format
The photo url must be https now. Also process an error otherwise the thread will crash. Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
-rw-r--r--xmppthread.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/xmppthread.py b/xmppthread.py
index 4edd3dd..9853c36 100644
--- a/xmppthread.py
+++ b/xmppthread.py
@@ -192,7 +192,10 @@ class XMPPThread(ComponentXMPP):
vcard['NICKNAME'] = user.full_name
if user.photo_url:
vcard['PHOTO']['TYPE'] = 'image/jpeg'
- vcard['PHOTO']['BINVAL'] = urllib.request.urlopen('http:' + user.photo_url).read()
+ try:
+ vcard['PHOTO']['BINVAL'] = urllib.request.urlopen('https:' + user.photo_url).read()
+ except (urllib.error.HTTPError):
+ logging.info("Failed to load photo from %s", user.photo_url)
self['xep_0054'].publish_vcard(jid=jid, vcard=vcard)