1
0
Fork 0
forked from s3lph/matemat

fix: default avatar missing after signup in non-kiosk mode

This commit is contained in:
s3lph 2024-12-07 23:28:15 +01:00
parent 2be7bf7683
commit 1823759433
Signed by untrusted user: s3lph
GPG key ID: 0AA29A52FB33CFB5

View file

@ -35,7 +35,9 @@ def signup_user(args: FormsDict, files: FormsDict, db: MatematDatabase) -> User:
# Finally, set the avatar, if provided # Finally, set the avatar, if provided
if 'avatar' in files: if 'avatar' in files:
avatar = files.avatar.file.read() avatar = files.avatar.file.read()
if len(avatar) > 0: else:
avatar = None
if avatar:
filemagic: magic.FileMagic = magic.detect_from_content(avatar) filemagic: magic.FileMagic = magic.detect_from_content(avatar)
if filemagic.mime_type.startswith('image/'): if filemagic.mime_type.startswith('image/'):
abspath: str = os.path.join(os.path.abspath(config['UploadDir']), 'thumbnails/users/') abspath: str = os.path.join(os.path.abspath(config['UploadDir']), 'thumbnails/users/')