in process_dm_images, check if it is actually an image (using pillow)
parent
9e30061d6d
commit
bdeb32b3cf
|
@ -288,6 +288,13 @@ def process_dm_images(v, user, body):
|
||||||
filename = f'/dm_images/{time.time()}'.replace('.','') + '.webp'
|
filename = f'/dm_images/{time.time()}'.replace('.','') + '.webp'
|
||||||
file.save(filename)
|
file.save(filename)
|
||||||
|
|
||||||
|
try:
|
||||||
|
with Image.open(filename) as i:
|
||||||
|
pass
|
||||||
|
except:
|
||||||
|
os.remove(filename)
|
||||||
|
abort(415)
|
||||||
|
|
||||||
size = os.stat(filename).st_size
|
size = os.stat(filename).st_size
|
||||||
patron = bool(v.patron)
|
patron = bool(v.patron)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue