From d809334c7786d59bf3035b17db351c4f2ac72d7d Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sat, 22 Jan 2022 20:51:33 +0200 Subject: [PATCH] vcxxvc --- files/helpers/images.py | 2 +- files/routes/comments.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/files/helpers/images.py b/files/helpers/images.py index b227e3ba2a..6d1e22353f 100644 --- a/files/helpers/images.py +++ b/files/helpers/images.py @@ -11,7 +11,7 @@ def process_image(file=None, filename=None, resize=0): file.save(filename) i = IImage.open(file) else: i = IImage.open(filename) - except: abort(400) + except: return "" if resize: size = resize, resize diff --git a/files/routes/comments.py b/files/routes/comments.py index 7f5922a13a..0895b4d0d4 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -195,7 +195,9 @@ def api_comment(v): if request.files.get("file") and request.headers.get("cf-ipcountry") != "T1": file=request.files["file"] if file.content_type.startswith('image/'): - body += f"\n\n![]({process_image(file)})" + image = process_image(file) + if image == "": return {"error":"Image upload failed"} + body += f"\n\n![]({image})" if v.admin_level == 3: if parent_post.id == 37696: filename = 'files/assets/images/Drama/sidebar/' + str(len(listdir('files/assets/images/Drama/sidebar'))+1) + '.webp'