Philipp Hörist pushed to branch master at gajim / gajim
Commits: cdf4d0ee by Emmanuel Gil Peyrot at 2017-11-25T17:37:48+00:00 Also log the offending JID on avatar decoding issue
- - - - - efc14f9d by Philipp Hörist at 2017-11-25T18:44:08+01:00 Merge branch 'better-avatar-error-log' into 'master'
Also log the offending JID on avatar decoding issue
See merge request gajim/gajim!158 - - - - -
2 changed files:
- gajim/common/connection_handlers.py - gajim/vcard.py
Changes:
===================================== gajim/common/connection_handlers.py ===================================== --- a/gajim/common/connection_handlers.py +++ b/gajim/common/connection_handlers.py @@ -474,7 +474,7 @@ class ConnectionVcard: app.nec.push_incoming_event( VcardNotPublishedEvent(None, conn=self))
- def get_vcard_photo(self, vcard): + def _get_vcard_photo(self, vcard, jid): try: photo = vcard['PHOTO']['BINVAL'] except (KeyError, AttributeError): @@ -488,7 +488,7 @@ class ConnectionVcard: try: photo_decoded = base64.b64decode(photo.encode('utf-8')) except binascii.Error as error: - app.log('avatar').warning('Invalid Avatar: %s', error) + app.log('avatar').warning('Invalid avatar for %s: %s', jid, error) return None, None avatar_sha = hashlib.sha1(photo_decoded).hexdigest()
@@ -532,7 +532,7 @@ class ConnectionVcard:
def _on_own_avatar_received(self, jid, resource, room, vcard):
- avatar_sha, photo_decoded = self.get_vcard_photo(vcard) + avatar_sha, photo_decoded = self._get_vcard_photo(vcard, jid)
app.log('avatar').info( 'Received own (vCard): %s', avatar_sha) @@ -570,7 +570,7 @@ class ConnectionVcard: """ Called when we receive a vCard Parse the vCard and trigger Events """ - avatar_sha, photo_decoded = self.get_vcard_photo(vcard) + avatar_sha, photo_decoded = self._get_vcard_photo(vcard, jid) app.interface.save_avatar(photo_decoded)
# Received vCard from a contact
===================================== gajim/vcard.py ===================================== --- a/gajim/vcard.py +++ b/gajim/vcard.py @@ -202,7 +202,7 @@ class VcardWindow: except AttributeError: pass
- def set_values(self, vcard): + def _set_values(self, vcard, jid): for i in vcard.keys(): if i == 'PHOTO' and self.xml.get_object('information_notebook').\ get_n_pages() > 4: @@ -215,7 +215,7 @@ class VcardWindow: photo_decoded = base64.b64decode( photo_encoded.encode('utf-8')) except binascii.Error as error: - app.log('avatar').warning('Invalid Avatar: %s', error) + app.log('avatar').warning('Invalid avatar for %s: %s', jid, error) continue pixbuf = gtkgui_helpers.get_pixbuf_from_data(photo_decoded) if pixbuf is None: @@ -266,7 +266,7 @@ class VcardWindow:
def _nec_vcard_received(self, jid, resource, room, vcard): self.clear_values() - self.set_values(vcard) + self._set_values(vcard, jid)
def set_os_info(self, obj): if obj.conn.name != self.account:
View it on GitLab: https://dev.gajim.org/gajim/gajim/compare/fc627fc19cc145a86383b221416422709b...
--- View it on GitLab: https://dev.gajim.org/gajim/gajim/compare/fc627fc19cc145a86383b221416422709b... You're receiving this email because of your account on dev.gajim.org.