sha is now computed on the raw image data and not the base64 encoded data
This commit is contained in:
parent
5260f38ea8
commit
ed47580227
|
@ -35,6 +35,7 @@ import socket
|
||||||
import random
|
import random
|
||||||
random.seed()
|
random.seed()
|
||||||
import signal
|
import signal
|
||||||
|
import base64
|
||||||
if os.name != 'nt':
|
if os.name != 'nt':
|
||||||
signal.signal(signal.SIGPIPE, signal.SIG_DFL)
|
signal.signal(signal.SIGPIPE, signal.SIG_DFL)
|
||||||
|
|
||||||
|
@ -267,7 +268,8 @@ class Connection:
|
||||||
if vcard.has_key('PHOTO') and isinstance(vcard['PHOTO'], dict) and \
|
if vcard.has_key('PHOTO') and isinstance(vcard['PHOTO'], dict) and \
|
||||||
vcard['PHOTO'].has_key('BINVAL'):
|
vcard['PHOTO'].has_key('BINVAL'):
|
||||||
photo = vcard['PHOTO']['BINVAL']
|
photo = vcard['PHOTO']['BINVAL']
|
||||||
avatar_sha = sha.sha(photo).hexdigest()
|
photo_decoded = base64.decodestring(photo)
|
||||||
|
avatar_sha = sha.sha(photo_decoded).hexdigest()
|
||||||
else:
|
else:
|
||||||
avatar_sha = ''
|
avatar_sha = ''
|
||||||
|
|
||||||
|
@ -2127,11 +2129,8 @@ class Connection:
|
||||||
if vcard.has_key('PHOTO') and isinstance(vcard['PHOTO'], dict) and \
|
if vcard.has_key('PHOTO') and isinstance(vcard['PHOTO'], dict) and \
|
||||||
vcard['PHOTO'].has_key('BINVAL'):
|
vcard['PHOTO'].has_key('BINVAL'):
|
||||||
photo = vcard['PHOTO']['BINVAL']
|
photo = vcard['PHOTO']['BINVAL']
|
||||||
avatar_sha = sha.sha(photo).hexdigest()
|
photo_decoded = base64.decodestring(photo)
|
||||||
else:
|
avatar_sha = sha.sha(photo_decoded).hexdigest()
|
||||||
avatar_sha = ''
|
|
||||||
|
|
||||||
if avatar_sha:
|
|
||||||
iq2.getTag('PHOTO').setTagData('SHA', avatar_sha)
|
iq2.getTag('PHOTO').setTagData('SHA', avatar_sha)
|
||||||
|
|
||||||
self.awaiting_answers[id] = (VCARD_PUBLISHED, iq2)
|
self.awaiting_answers[id] = (VCARD_PUBLISHED, iq2)
|
||||||
|
|
Loading…
Reference in New Issue