From 40c2360d00f8a303076146242cca9779bb526a1e Mon Sep 17 00:00:00 2001 From: justcool393 Date: Fri, 30 Sep 2022 15:43:36 -0700 Subject: [PATCH] don't duplicate checks for comments --- files/routes/admin.py | 3 --- files/routes/subs.py | 3 --- files/routes/votes.py | 4 ---- 3 files changed, 10 deletions(-) diff --git a/files/routes/admin.py b/files/routes/admin.py index 634e054a7..10ea73895 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -1318,10 +1318,7 @@ def unsticky_comment(cid, v): @limiter.limit("1/second;30/minute;200/hour;1000/day") @admin_level_required(2) def remove_comment(c_id, v): - comment = get_comment(c_id) - if not comment: - abort(404) comment.is_banned = True comment.is_approved = None diff --git a/files/routes/subs.py b/files/routes/subs.py index 56fd7f7b2..516ee789f 100644 --- a/files/routes/subs.py +++ b/files/routes/subs.py @@ -48,9 +48,6 @@ def exile_post(v, pid): @is_not_permabanned def exile_comment(v, cid): if v.shadowbanned: return {"error": "Internal Server Error"}, 500 - try: cid = int(cid) - except: abort(400) - c = get_comment(cid) sub = c.post.sub if not sub: abort(400) diff --git a/files/routes/votes.py b/files/routes/votes.py index 513f3572f..caba2ee9c 100644 --- a/files/routes/votes.py +++ b/files/routes/votes.py @@ -133,10 +133,6 @@ def vote_comment(comment_id, new, v): if request.headers.get("Authorization") and v.id != BBBB_ID: abort(403) new = int(new) - - try: comment_id = int(comment_id) - except: abort(404) - comment = get_comment(comment_id) coin_delta = 1