From a5251ba5616bca2ecff557b94247aa66f776dc7a Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 4 Feb 2020 19:20:16 +0000 Subject: [PATCH] Tidying --- inbox.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/inbox.py b/inbox.py index 230ba70ad..6eb2a8972 100644 --- a/inbox.py +++ b/inbox.py @@ -775,17 +775,11 @@ def personReceiveUpdate(baseDir: str, \ # remove avatar if it exists so that it will be refreshed later # when a timeline is constructed actorStr=personJson['id'].replace('/','-') - avatarFilename=baseDir+'/cache/avatars/'+actorStr+'.png' - if os.path.isfile(avatarFilename): - os.remove(avatarFilename) - else: - avatarFilename=baseDir+'/cache/avatars/'+actorStr+'.jpg' + avatarFilenameExtensions=('png','jpg','gif','webp') + for extension in avatarFilenameExtensions: + avatarFilename=baseDir+'/cache/avatars/'+actorStr+'.'+extension if os.path.isfile(avatarFilename): os.remove(avatarFilename) - else: - avatarFilename=baseDir+'/cache/avatars/'+actorStr+'.gif' - if os.path.isfile(avatarFilename): - os.remove(avatarFilename) return True def receiveUpdateToQuestion(recentPostsCache: {},messageJson: {}, \