Checking for image extensions

main
Bob Mottram 2021-07-04 12:15:26 +01:00
parent 3914cccfb0
commit e1a90cd319
1 changed files with 2 additions and 5 deletions

View File

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