Fix caching newer avatars.

This commit is contained in:
Emmanuel Gil Peyrot 2018-01-25 15:42:51 +01:00
parent e61d5fd947
commit 4c2eee6a13

View file

@ -427,10 +427,11 @@ class HandlerCore:
# Now we save the data on the file system to not have to request it again.
try:
makedirs(cache_dir)
makedirs(cache_dir, exist_ok=True)
with open(cached_path, 'wb') as avatar_file:
avatar_file.write(contact.avatar)
except OSError:
log.debug('Failed writing %s avatar to cache:', jid, exc_info=True)
pass
return
@ -467,10 +468,11 @@ class HandlerCore:
# Now we save the data on the file system to not have to request it again.
try:
makedirs(cache_dir)
makedirs(cache_dir, exist_ok=True)
with open(cached_path, 'wb') as avatar_file:
avatar_file.write(contact.avatar)
except OSError:
log.debug('Failed writing %s avatar to cache:', jid, exc_info=True)
pass
def on_nick_received(self, message):