Premature case insensitivity

main
Bob Mottram 2020-05-04 19:33:13 +01:00
parent e8b5a26189
commit 2fe45d8931
1 changed files with 6 additions and 7 deletions

View File

@ -255,17 +255,16 @@ def getPersonAvatarUrl(baseDir: str, personUrl: str, personCache: {}) -> str:
return None return None
# get from locally stored image # get from locally stored image
actorStr = personJson['id'].replace('/', '-') actorStr = personJson['id'].replace('/', '-')
avatarImagePath = \ avatarImagePath = baseDir + '/cache/avatars/' + actorStr
getFileCaseInsensitive(baseDir + '/cache/avatars/' + actorStr) if os.path.isfile(getFileCaseInsensitive((avatarImagePath + '.png')):
if os.path.isfile(avatarImagePath + '.png'):
return '/avatars/' + actorStr + '.png' return '/avatars/' + actorStr + '.png'
elif os.path.isfile(avatarImagePath + '.jpg'): elif os.path.isfile(getFileCaseInsensitive(avatarImagePath + '.jpg')):
return '/avatars/' + actorStr + '.jpg' return '/avatars/' + actorStr + '.jpg'
elif os.path.isfile(avatarImagePath + '.gif'): elif os.path.isfile(getFileCaseInsensitive(avatarImagePath + '.gif')):
return '/avatars/' + actorStr + '.gif' return '/avatars/' + actorStr + '.gif'
elif os.path.isfile(avatarImagePath + '.webp'): elif os.path.isfile(getFileCaseInsensitive(avatarImagePath + '.webp')):
return '/avatars/' + actorStr + '.webp' return '/avatars/' + actorStr + '.webp'
elif os.path.isfile(avatarImagePath): elif os.path.isfile(getFileCaseInsensitive(avatarImagePath)):
return '/avatars/' + actorStr return '/avatars/' + actorStr
if personJson.get('icon'): if personJson.get('icon'):