diff --git a/files/helpers/sanitize.py b/files/helpers/sanitize.py index ff272c042..7127c5bc8 100644 --- a/files/helpers/sanitize.py +++ b/files/helpers/sanitize.py @@ -89,6 +89,8 @@ def sanitize(sanitized, alert=False, comment=False, edit=False): sanitized = linefeeds_regex.sub(r'\1\n\n\2', sanitized) + sanitized = image_regex.sub(r'\1![](\2)\4', sanitized) + sanitized = image_check_regex.sub(r'\1', sanitized) sanitized = markdown(sanitized) diff --git a/files/routes/comments.py b/files/routes/comments.py index 2da7d2c5b..87a453ecd 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -204,8 +204,6 @@ def api_comment(v): if not body and not request.files.get('file'): return {"error":"You need to actually write something!"}, 400 - body = image_regex.sub(r'\1![](\2)\4', body) - options = [] for i in poll_regex.finditer(body): options.append(i.group(1)) @@ -694,8 +692,6 @@ def edit_comment(cid, v): elif v.bird and len(body) > 140: return {"error":"You have to type less than 140 characters!"}, 403 - body = image_regex.sub(r'\1![](\2)\4', body) - if v.agendaposter and not v.marseyawarded: body = torture_ap(body, v.username) diff --git a/files/routes/posts.py b/files/routes/posts.py index 02b851039..760568876 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -474,8 +474,6 @@ def edit_post(pid, v): else: return {"error": "Image/Video files only"}, 400 if body != p.body: - body = image_regex.sub(r'\1![](\2)\4', body) - if v.id == p.author_id and v.agendaposter and not v.marseyawarded: body = torture_ap(body, v.username) if not p.options.count(): @@ -1054,8 +1052,6 @@ def submit_post(v, sub=None): if len(url) > 2048: return error("There's a 2048 character limit for URLs.") - body = image_regex.sub(r'\1![](\2)\4', body) - if v and v.admin_level > 2: bet_options = [] for i in bet_regex.finditer(body): diff --git a/files/routes/settings.py b/files/routes/settings.py index e4fce3f5b..8bb3228a1 100644 --- a/files/routes/settings.py +++ b/files/routes/settings.py @@ -136,8 +136,6 @@ def settings_profile_post(v): elif (v.patron or v.id == MOOSE_ID) and request.values.get("sig"): sig = request.values.get("sig")[:200] - sig = image_regex.sub(r'\1![](\2)\4', sig) - sig_html = sanitize(sig) if len(sig_html) > 1000: @@ -159,8 +157,6 @@ def settings_profile_post(v): elif request.values.get("friends"): friends = request.values.get("friends")[:500] - friends = image_regex.sub(r'\1![](\2)\4', friends) - friends_html = sanitize(friends) if len(friends_html) > 2000: @@ -188,8 +184,6 @@ def settings_profile_post(v): elif request.values.get("enemies"): enemies = request.values.get("enemies")[:500] - enemies = image_regex.sub(r'\1![](\2)\4', enemies) - enemies_html = sanitize(enemies) if len(enemies_html) > 2000: @@ -217,8 +211,6 @@ def settings_profile_post(v): elif request.values.get("bio") or request.files.get('file') and request.headers.get("cf-ipcountry") != "T1": bio = request.values.get("bio")[:1500] - bio = image_regex.sub(r'\1![](\2)\4', bio) - if request.files.get('file'): file = request.files['file'] if file.content_type.startswith('image/'):