diff options
author | James Bottomley <James.Bottomley@HansenPartnership.com> | 2018-12-09 15:30:17 -0800 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2018-12-09 15:30:17 -0800 |
commit | 78f8fbb99381a55a3753a5df2f60506103e98085 (patch) | |
tree | 396fbd8cd3c2dda47c4d18d5a72d6e107443cbb3 | |
parent | b6cf412d7ba723c90ceb653e802ca7c75a7928c2 (diff) | |
download | hangouts-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.py | 5 |
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) |