catch traceback when decoding avatar. Fixes #1470

This commit is contained in:
Yann Leboulanger 2006-02-03 12:32:18 +00:00
parent f62db4acfe
commit 327f07c6aa
1 changed files with 5 additions and 2 deletions

View File

@ -282,8 +282,11 @@ class Connection:
if vcard.has_key('PHOTO') and isinstance(vcard['PHOTO'], dict) and \
vcard['PHOTO'].has_key('BINVAL'):
photo = vcard['PHOTO']['BINVAL']
photo_decoded = base64.decodestring(photo)
avatar_sha = sha.sha(photo_decoded).hexdigest()
try:
photo_decoded = base64.decodestring(photo)
avatar_sha = sha.sha(photo_decoded).hexdigest()
except:
avatar_sha = ''
else:
avatar_sha = ''