Dont show error when receiving invalid avatars

Fixes #9022
This commit is contained in:
Philipp Hörist 2018-04-14 10:34:58 +02:00
parent 9f0eaf9df7
commit 93af68f81c
1 changed files with 5 additions and 1 deletions

View File

@ -483,6 +483,10 @@ class AvatarNotificationPEP(AbstractPEP):
def _extract_info(self, items): def _extract_info(self, items):
self.avatar = None self.avatar = None
for item in items.getTags('item'): for item in items.getTags('item'):
metadata = item.getTag('metadata')
if metadata is None:
app.log('avatar').warning('Invalid avatar stanza:\n%s', items)
break
info = item.getTag('metadata').getTag('info') info = item.getTag('metadata').getTag('info')
if info is not None: if info is not None:
self.avatar = info.getAttrs() self.avatar = info.getAttrs()
@ -494,7 +498,7 @@ class AvatarNotificationPEP(AbstractPEP):
con = app.connections[account] con = app.connections[account]
if self.avatar is None: if self.avatar is None:
# Remove avatar # Remove avatar
app.log('avatar').debug('Remove (Pubsub): %s', jid) app.log('avatar').info('Remove (Pubsub): %s', jid)
app.contacts.set_avatar(account, jid, None) app.contacts.set_avatar(account, jid, None)
own_jid = con.get_own_jid().getStripped() own_jid = con.get_own_jid().getStripped()
app.logger.set_avatar_sha(own_jid, jid, None) app.logger.set_avatar_sha(own_jid, jid, None)