From cb5a5a99d1571ddda0a800953aba8a1353712466 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 15 Dec 2021 12:59:48 +0000 Subject: [PATCH] More general search for images --- daemon.py | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/daemon.py b/daemon.py index 242faf749..716c90b0a 100644 --- a/daemon.py +++ b/daemon.py @@ -12716,12 +12716,23 @@ class PubServer(BaseHTTPRequestHandler): avatarFilename = \ acctDir(baseDir, avatarNickname, domain) + '/' + avatarFile if not os.path.isfile(avatarFilename): - if avatarFileExt == 'png': - return False - avatarFile = avatarFile.replace('.' + avatarFileExt, '.png') - avatarFilename = \ - acctDir(baseDir, avatarNickname, domain) + '/' + avatarFile - if not os.path.isfile(avatarFilename): + originalExt = avatarFileExt + originalAvatarFile = avatarFile + altExt = getImageExtensions() + altFound = False + for alt in altExt: + if alt == originalExt: + continue + avatarFile = \ + originalAvatarFile.replace('.' + originalExt, + '.' + alt) + avatarFilename = \ + acctDir(baseDir, avatarNickname, domain) + \ + '/' + avatarFile + if os.path.isfile(avatarFilename): + altFound = True + break + if not altFound: return False if self._etag_exists(avatarFilename): # The file has not changed