This commit is contained in:
Aevann1 2021-11-21 15:49:57 +02:00
parent 7120101f8a
commit 45b579a3b0
2 changed files with 9 additions and 9 deletions

View file

@ -168,7 +168,7 @@ def api_comment(v):
if time.time() > v.longpost:
v.longpost = None
g.db.add(v)
elif len(body) < 280: return {"error":"You have to type more than 280 characters!"}, 403
elif len(body) < 280 or ' [](' in body or body.startswith('[]('): return {"error":"You have to type more than 280 characters!"}, 403
if not body and not request.files.get('file'): return {"error":"You need to actually write something!"}, 400
@ -194,7 +194,7 @@ def api_comment(v):
if v.marseyawarded and len(list(re.finditer('>[^<\s+]|[^>\s+]<', body_html))) > 0: return {"error":"You can only type marseys!"}, 403
if v.longpost and len(body) < 280: return {"error":"You have to type more than 280 characters!"}, 403
if v.longpost and (len(body) < 280 or ' [](' in body or body.startswith('[](')): return {"error":"You have to type more than 280 characters!"}, 403
bans = filter_comment_html(body_html)
@ -621,7 +621,7 @@ def edit_comment(cid, v):
if time.time() > v.longpost:
v.longpost = None
g.db.add(v)
elif len(body) < 280: return {"error":"You have to type more than 280 characters!"}, 403
elif len(body) < 280 or ' [](' in body or body.startswith('[]('): return {"error":"You have to type more than 280 characters!"}, 403
for i in re.finditer('^(https:\/\/.*\.(png|jpg|jpeg|gif|webp|PNG|JPG|JPEG|GIF|WEBP|9999))', body, re.MULTILINE):
if "wikipedia" not in i.group(1): body = body.replace(i.group(1), f'![]({i.group(1)})')
@ -630,7 +630,7 @@ def edit_comment(cid, v):
if v.marseyawarded and len(list(re.finditer('>[^<\s+]|[^>\s+]<', body_html))) > 0: return {"error":"You can only type marseys!"}, 403
if v.longpost and len(body) < 280: return {"error":"You have to type more than 280 characters!"}, 403
if v.longpost and (len(body) < 280 or ' [](' in body or body.startswith('[](')): return {"error":"You have to type more than 280 characters!"}, 403
bans = filter_comment_html(body_html)