From e1a90cd3194c7fa8acb298e2618b2e6f267c28d9 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 4 Jul 2021 12:15:26 +0100 Subject: [PATCH] Checking for image extensions --- person.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/person.py b/person.py index ce426680f..4e76f6f00 100644 --- a/person.py +++ b/person.py @@ -49,6 +49,7 @@ from utils import refreshNewswire from utils import getProtocolPrefixes from utils import hasUsersPath from utils import getImageExtensions +from utils import isImageFile from session import createSession from session import getJson from webfinger import webfingerHandle @@ -84,11 +85,7 @@ def setProfileImage(baseDir: str, httpPrefix: str, nickname: str, domain: str, image for the given person """ imageFilename = imageFilename.replace('\n', '').replace('\r', '') - if not (imageFilename.endswith('.png') or - imageFilename.endswith('.jpg') or - imageFilename.endswith('.jpeg') or - imageFilename.endswith('.svg') or - imageFilename.endswith('.gif')): + if not isImageFile(imageFilename): print('Profile image must be png, jpg, gif or svg format') return False