in process_dm_images, check if it is actually an image (using pillow)

pull/142/head
Aevann 2023-03-17 13:00:54 +02:00
parent 9e30061d6d
commit bdeb32b3cf
1 changed files with 7 additions and 0 deletions

View File

@ -288,6 +288,13 @@ def process_dm_images(v, user, body):
filename = f'/dm_images/{time.time()}'.replace('.','') + '.webp'
file.save(filename)
try:
with Image.open(filename) as i:
pass
except:
os.remove(filename)
abort(415)
size = os.stat(filename).st_size
patron = bool(v.patron)