From f27a42bdcff9c9bdb1d5c36f9c15e6566e6779b5 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Fri, 10 Dec 2021 20:24:35 +0200 Subject: [PATCH] fdsfds --- files/helpers/sanitize.py | 12 ++++++------ files/routes/comments.py | 4 ++-- files/routes/posts.py | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/files/helpers/sanitize.py b/files/helpers/sanitize.py index 7343ea3676..51caa49008 100644 --- a/files/helpers/sanitize.py +++ b/files/helpers/sanitize.py @@ -183,7 +183,7 @@ def sanitize(sanitized, noimages=False): remoji = emoji if path.isfile(f'./files/assets/images/emojis/{remoji}.webp'): - new = re.sub(f'(?', new) + new = re.sub(f'(?', new, flags=re.I) sanitized = sanitized.replace(old, new) @@ -193,10 +193,10 @@ def sanitize(sanitized, noimages=False): if emoji.startswith("!"): emoji = emoji[1:] if path.isfile(f'./files/assets/images/emojis/{emoji}.webp'): - sanitized = re.sub(f'(?', sanitized) + sanitized = re.sub(f'(?', sanitized, flags=re.I) elif path.isfile(f'./files/assets/images/emojis/{emoji}.webp'): - sanitized = re.sub(f'(?', sanitized) + sanitized = re.sub(f'(?', sanitized, flags=re.I) sanitized = sanitized.replace("https://www.", "https://").replace("https://youtu.be/", "https://youtube.com/watch?v=").replace("https://music.youtube.com/watch?v=", "https://youtube.com/watch?v=").replace("https://open.spotify.com/", "https://open.spotify.com/embed/").replace("https://streamable.com/", "https://streamable.com/e/").replace("https://youtube.com/shorts/", "https://youtube.com/watch?v=").replace("https://mobile.twitter", "https://twitter").replace("https://m.facebook", "https://facebook").replace("https://m.wikipedia", "https://wikipedia").replace("https://m.youtube", "https://youtube") @@ -235,15 +235,15 @@ def filter_emojis_only(title): title = bleach.clean(title, tags=[]) for i in re.finditer('(?', title) + title = re.sub(f'(?', title, flags=re.I) elif path.isfile(f'./files/assets/images/emojis/{emoji}.webp'): - title = re.sub(f'(?', title) + title = re.sub(f'(?', title, flags=re.I) if len(title) > 1500: abort(400) else: return title \ No newline at end of file diff --git a/files/routes/comments.py b/files/routes/comments.py index 36f7208107..730fba9f31 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -157,7 +157,7 @@ def api_comment(v): else: top_comment_id = parent.top_comment_id else: abort(400) - body = request.values.get("body", "").strip()[:10000] + body = request.values.get("body", "").strip()[:10000].upper() if v.marseyawarded: if time.time() > v.marseyawarded: @@ -615,7 +615,7 @@ def edit_comment(cid, v): if c.is_banned or c.deleted_utc > 0: abort(403) - body = request.values.get("body", "").strip()[:10000] + body = request.values.get("body", "").strip()[:10000].upper() if len(body) < 1: return {"error":"You have to actually type something!"}, 400 if body != c.body and body != "": diff --git a/files/routes/posts.py b/files/routes/posts.py index 22994c6b35..6197dae5b6 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -335,8 +335,8 @@ def edit_post(pid, v): if p.author_id != v.id and not (v.admin_level > 1 and v.admin_level > 2): abort(403) - title = request.values.get("title", "").strip() - body = request.values.get("body", "").strip() + title = request.values.get("title", "").strip().upper() + body = request.values.get("body", "").strip().upper() if len(body) > 10000: return {"error":"Character limit is 10000!"}, 403 @@ -669,7 +669,7 @@ def submit_post(v): if request.content_length > 8 * 1024 * 1024: return "Max file size is 8 MB.", 413 elif request.content_length > 4 * 1024 * 1024: return "Max file size is 4 MB.", 413 - title = request.values.get("title", "").strip()[:500] + title = request.values.get("title", "").strip()[:500].upper() url = request.values.get("url", "").strip() if v.agendaposter and not v.marseyawarded: @@ -678,7 +678,7 @@ def submit_post(v): title = censor_slurs2(title).upper().replace(' ME ', f' @{v.username} ') title_html = filter_emojis_only(title) - body = request.values.get("body", "").strip() + body = request.values.get("body", "").strip().upper() if v.marseyawarded and len(list(re.finditer('>[^<\s+]|[^>\s+]<', title_html))) > 0: return {"error":"You can only type marseys!"}, 40