More general search for images

main
Bob Mottram 2021-12-15 12:59:48 +00:00
parent 30498f4b39
commit cb5a5a99d1
1 changed files with 17 additions and 6 deletions

View File

@ -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