use get_post to handle getting a post (#381)

why did we ever catch an exception throw it away, then catch an exception (something get_post already does) and then finally get the post
master
justcool393 2022-09-29 22:44:32 -07:00 committed by GitHub
parent 19cde8ae99
commit 0617bb154c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 0 additions and 9 deletions

View File

@ -105,16 +105,7 @@ def submit_get(v, sub=None):
@app.get("/logged_out/h/<sub>/post/<pid>/<anything>") @app.get("/logged_out/h/<sub>/post/<pid>/<anything>")
@auth_desired_with_logingate @auth_desired_with_logingate
def post_id(pid, anything=None, v=None, sub=None): def post_id(pid, anything=None, v=None, sub=None):
try: pid = int(pid)
except Exception as e: pass
try: pid = int(pid)
except: abort(404)
post = get_post(pid, v=v) post = get_post(pid, v=v)
if not post.can_see(v): abort(403) if not post.can_see(v): abort(403)
if post.over_18 and not (v and v.over_18) and session.get('over_18', 0) < int(time.time()): if post.over_18 and not (v and v.over_18) and session.get('over_18', 0) < int(time.time()):