From fe99792df93a99b03abcdb93a670eee30dacab71 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 13 Sep 2021 20:38:15 +0100 Subject: [PATCH] Tidying --- person.py | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/person.py b/person.py index 6ca49e9e7..541a265aa 100644 --- a/person.py +++ b/person.py @@ -1427,19 +1427,18 @@ def getPersonAvatarUrl(baseDir: str, personUrl: str, personCache: {}, imageExtension = getImageExtensions() for ext in imageExtension: - if os.path.isfile(avatarImagePath + '.' + ext): - if ext == 'svg': - if not dangerousSVG(avatarImagePath + '.' + ext, False): - return '/avatars/' + actorStr + '.' + ext - else: - return '/avatars/' + actorStr + '.' + ext - elif os.path.isfile(avatarImagePath.lower() + '.' + ext): - if ext == 'svg': - if not dangerousSVG(avatarImagePath.lower() + '.' + ext, - False): - return '/avatars/' + actorStr.lower() + '.' + ext - else: - return '/avatars/' + actorStr.lower() + '.' + ext + imFilename = avatarImagePath + '.' + ext + imPath = '/avatars/' + actorStr + '.' + ext + if not os.path.isfile(imFilename): + imFilename = avatarImagePath.lower() + '.' + ext + imPath = '/avatars/' + actorStr.lower() + '.' + ext + if not os.path.isfile(imFilename): + continue + if ext == 'svg': + if not dangerousSVG(imFilename, False): + return imPath + else: + return imPath if personJson.get('icon'): if personJson['icon'].get('url'):