From c9ab2c515b7fa9c3139d18212ee605f028d33795 Mon Sep 17 00:00:00 2001 From: justcool393 Date: Sun, 9 Oct 2022 01:25:21 -0700 Subject: [PATCH] remove some more vestiges get_post and get_comment both handle this --- files/routes/comments.py | 8 -------- files/routes/posts.py | 2 +- files/routes/subs.py | 6 ------ 3 files changed, 1 insertion(+), 15 deletions(-) diff --git a/files/routes/comments.py b/files/routes/comments.py index 773d3d86b..c2f923d52 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -33,12 +33,7 @@ WORDLE_COLOR_MAPPINGS = {-1: "🟥", 0: "🟨", 1: "🟩"} @app.get("/logged_out/h//post///") @auth_desired_with_logingate def post_pid_comment_cid(cid, pid=None, anything=None, v=None, sub=None): - - try: cid = int(cid) - except: abort(404) - comment = get_comment(cid, v=v) - if not comment.can_see(v): abort(403) if comment.author.shadowbanned and not (v and v.shadowbanned) and not (v and v.admin_level >= PERMS['USER_SHADOWBAN']): @@ -60,9 +55,6 @@ def post_pid_comment_cid(cid, pid=None, anything=None, v=None, sub=None): elif SITE == 'pcmemes.net': pid = 2487 else: pid = 1 - try: pid = int(pid) - except: abort(404) - post = get_post(pid, v=v) if post.over_18 and not (v and v.over_18) and not session.get('over_18', 0) >= int(time.time()): diff --git a/files/routes/posts.py b/files/routes/posts.py index ff120fd86..37ce2177e 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -353,7 +353,7 @@ def viewmore(v, pid, sort, offset): @auth_desired_with_logingate def morecomments(v, cid): try: cid = int(cid) - except: abort(400) + except: abort(404) tcid = g.db.query(Comment.top_comment_id).filter_by(id=cid).one_or_none()[0] diff --git a/files/routes/subs.py b/files/routes/subs.py index da830ea87..1f9b80bb2 100644 --- a/files/routes/subs.py +++ b/files/routes/subs.py @@ -12,9 +12,6 @@ import tldextract @is_not_permabanned def exile_post(v, pid): if v.shadowbanned: return {"error": "Internal Server Error"}, 500 - try: pid = int(pid) - except: abort(400) - p = get_post(pid) sub = p.sub if not sub: abort(400) @@ -354,9 +351,6 @@ def create_sub2(v): @app.post("/kick/") @is_not_permabanned def kick(v, pid): - try: pid = int(pid) - except: abort(400) - post = get_post(pid) if not post.sub: abort(403)