master
fireworks88 2021-09-09 20:36:46 +02:00
parent 2128c1bcca
commit 2cf6ad60a3
1 changed files with 3 additions and 3 deletions

View File

@ -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")