From 2054987f0269fac5f586d9f710d9cb949094f522 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Thu, 7 Oct 2021 01:14:51 +0200 Subject: [PATCH] dsffds --- files/routes/comments.py | 27 +++++++++---------------- files/templates/submission.html | 4 ++-- files/templates/submission_listing.html | 2 +- 3 files changed, 12 insertions(+), 21 deletions(-) diff --git a/files/routes/comments.py b/files/routes/comments.py index d08864c869..8d152ed8d1 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -127,27 +127,21 @@ def post_pid_comment_cid(cid, pid=None, anything=None, v=None): def api_comment(v): if request.content_length > 4 * 1024 * 1024: return "Max file size is 4 MB.", 413 - parent_submission = request.values.get("submission") - parent_fullname = request.values.get("parent_fullname") + parent_submission = request.values.get("submission").strip() + parent_fullname = request.values.get("parent_fullname").strip() - # get parent item info - parent_id = parent_fullname.split("_")[1] - if parent_fullname.startswith("t2"): - parent_post = get_post(parent_id, v=v) - if parent_post.club and not (v and v.paid_dues): abort(403) + parent_post = get_post(parent_submission, v=v) + if parent_post.club and not (v and v.paid_dues): abort(403) + + if parent_fullname.startswith("t2_"): parent = parent_post parent_comment_id = None level = 1 - parent_submission = parent_id - elif parent_fullname.startswith("t3"): - parent = get_comment(parent_id, v=v) + elif parent_fullname.startswith("t3_"): + parent = get_comment(parent_fullname.split("_")[1], v=v) parent_comment_id = parent.id level = parent.level + 1 - parent_id = parent.parent_submission - parent_submission = parent_id - parent_post = get_post(parent_id) - else: - abort(400) + else: abort(400) #process and sanitize body = request.values.get("body", "")[:10000] @@ -239,9 +233,6 @@ def api_comment(v): return {"error": "Too much spam!"}, 403 - # create comment - parent_id = parent_fullname.split("_")[1] - if request.files.get("file") and request.headers.get("cf-ipcountry") != "T1": file=request.files["file"] if not file.content_type.startswith('image/'): return {"error": "That wasn't an image!"}, 400 diff --git a/files/templates/submission.html b/files/templates/submission.html index 884ebb19a3..a6338b151c 100644 --- a/files/templates/submission.html +++ b/files/templates/submission.html @@ -319,12 +319,12 @@ {% endif %} {% if p.realurl(v) %}

- {% if p.club %}COUNTRY CLUB{% endif %} + {% if p.club %}COUNTRY CLUB{% endif %} {{p.realtitle(v) | safe}}

{% else %}

- {% if p.club %}COUNTRY CLUB{% endif %} + {% if p.club %}COUNTRY CLUB{% endif %} {{p.realtitle(v) | safe}}

{% endif %} diff --git a/files/templates/submission_listing.html b/files/templates/submission_listing.html index 071aafb877..2537dcfc02 100644 --- a/files/templates/submission_listing.html +++ b/files/templates/submission_listing.html @@ -149,7 +149,7 @@
- {% if p.club %}COUNTRY CLUB{% endif %} + {% if p.club %}COUNTRY CLUB{% endif %} {{p.realtitle(v) | safe}}