Default to jpg cached avatars

main2
Bob Mottram 2019-10-18 10:00:16 +01:00
parent bbb544f373
commit b79703dbfd
2 changed files with 9 additions and 4 deletions

View File

@ -1092,7 +1092,9 @@ class PubServer(BaseHTTPRequestHandler):
elif mediaFilename.endswith('.gif'):
self._set_headers('image/gif',len(mediaBinary),cookie)
else:
self._404()
# default to jpeg
self._set_headers('image/jpeg',len(mediaBinary),cookie)
#self._404()
return
tries=0
while tries<5:

View File

@ -109,15 +109,18 @@ def getPersonAvatarUrl(baseDir: str,personUrl: str,personCache: {}) -> str:
if personJson:
# get from locally stored image
actorStr=personJson['id'].replace('/','-')
avatarImageFilename=baseDir+'/cache/avatars/'+actorStr+'.png'
avatarImagePath=baseDir+'/cache/avatars/'+actorStr
avatarImageFilename=avatarImagePath+'.png'
if os.path.isfile(avatarImageFilename):
return '/avatars/'+actorStr+'.png'
avatarImageFilename=baseDir+'/cache/avatars/'+actorStr+'.jpg'
avatarImageFilename=avatarImagePath+'.jpg'
if os.path.isfile(avatarImageFilename):
return '/avatars/'+actorStr+'.jpg'
avatarImageFilename=baseDir+'/cache/avatars/'+actorStr+'.gif'
avatarImageFilename=avatarImagePath+'.gif'
if os.path.isfile(avatarImageFilename):
return '/avatars/'+actorStr+'.gif'
if os.path.isfile(avatarImagePath):
return '/avatars/'+actorStr
if personJson.get('icon'):
if personJson['icon'].get('url'):