From 2a53df20ffed44aa9eccc025d135870d300ec830 Mon Sep 17 00:00:00 2001 From: justcool393 Date: Wed, 5 Oct 2022 01:19:45 -0700 Subject: [PATCH] consistency in return error and returned status code --- files/routes/posts.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/files/routes/posts.py b/files/routes/posts.py index 680c87aa2..df1583043 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -668,7 +668,7 @@ def submit_post(v, sub=None): body = sanitize_raw_body(request.values.get("body", "")) def error(error): - if request.headers.get("Authorization") or request.headers.get("xhr"): return {"error": error}, 403 + if request.headers.get("Authorization") or request.headers.get("xhr"): return {"error": error}, 400 SUBS = [x[0] for x in g.db.query(Sub.name).order_by(Sub.name).all()] return render_template("submit.html", SUBS=SUBS, v=v, error=error, title=title, url=url, body=body), 400 @@ -679,7 +679,8 @@ def submit_post(v, sub=None): title_html = filter_emojis_only(title, graceful=True, count_marseys=True, torture=torture) if v.marseyawarded and not marseyaward_title_regex.fullmatch(title_html): return error("You can only type marseys!") - if len(title_html) > 1500: return error("Rendered title is too big!") + if len(title_html) > 1500: + return error("Rendered title is too big!") sub = request.values.get("sub", "").lower().replace('/h/','').strip()