From 64b7c25894d54feeacaa7184a2efa11e8fd3948e Mon Sep 17 00:00:00 2001 From: fireworks88 Date: Sun, 5 Sep 2021 21:09:58 +0200 Subject: [PATCH] pcm --- files/routes/posts.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/files/routes/posts.py b/files/routes/posts.py index 29d8e94ec..9be4aa31d 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -852,7 +852,21 @@ def submit_post(v): if file.content_type.startswith('image/'): new_post.url = upload_ibb(file) else: - new_post.url = upload_video(file) + try: + new_post.url = upload_video(file) + except UploadException as e: + if request.headers.get("Authorization"): + return { + "error": str(e), + }, 400 + else: + return render_template( + "submit.html", + v=v, + error=str(e), + title=title, + body=request.form.get("body", "") + ), 400 else: if file.content_type.startswith('image/'): new_post.url = upload_imgur(file)