From 2cf6ad60a3f74b4b6da467aaf8865fed0238ac60 Mon Sep 17 00:00:00 2001 From: fireworks88 Date: Thu, 9 Sep 2021 20:36:46 +0200 Subject: [PATCH] js --- files/routes/comments.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/files/routes/comments.py b/files/routes/comments.py index 853294fa7a..a0659b718a 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -278,9 +278,9 @@ def api_comment(v): file=request.files["file"] if not file.content_type.startswith('image/'): return {"error": "That wasn't an image!"}, 400 - file.save(f"image.{file.format}", optimize=True, quality=30) - if 'pcmemes.net' in request.host: url = upload_ibb(f"image.{file.format}") - else: url = upload_imgur(f"image.{file.format}") + file.save(f"image.{file.filename.split('.')[-1]}") + if 'pcmemes.net' in request.host: url = upload_ibb(f"image.{file.filename.split('.')[-1]}") + else: url = upload_imgur(f"image.{file.filename.split('.')[-1]}") body = request.form.get("body") + f"\n![]({url})" body = body.replace("\n", "\n\n").replace("\n\n\n\n\n\n", "\n\n").replace("\n\n\n\n", "\n\n").replace("\n\n\n", "\n\n")