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>
diff --git a/xmppthread.py b/xmppthread.py index 4edd3dd..9853c36 100644 --- a/xmppthread.py +++ b/xmppthread.py
@@ -192,7 +192,10 @@ 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)