From 9e30061d6da72af5e1ea3b9870cd006899623591 Mon Sep 17 00:00:00 2001 From: Aevann Date: Fri, 17 Mar 2023 13:00:10 +0200 Subject: [PATCH] remove conditions from "except" to make sure the file removal always happens --- files/helpers/media.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/files/helpers/media.py b/files/helpers/media.py index 570f12129..ebcc5be4c 100644 --- a/files/helpers/media.py +++ b/files/helpers/media.py @@ -202,7 +202,7 @@ def process_image(filename:str, v, resize=0, trim=False, uploader_id:Optional[in params.append("-trim") if resize and i.width > resize: params.extend(["-resize", f"{resize}>"]) - except UnidentifiedImageError as e: + except: print(f"Couldn't identify an image for {filename}; deleting... (user {v.id if v else '-no user-'})") os.remove(filename) if has_request: @@ -305,7 +305,7 @@ def process_dm_images(v, user, body): timeout=20, proxies=proxies ).json() - except requests.Timeout: + except: abort(400, "Image upload timed out, please try again!") try: url = req['files'][0]['url']