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

@ -238,7 +238,7 @@ def edit_post(pid, 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 title != p.title:
title_html = filter_title(title)
@ -264,7 +264,7 @@ def edit_post(pid, v):
p.body = body
if v.marseyawarded and len(list(re.finditer('>[^<\s+]|[^>\s+]<', body_html))) > 0: return {"error":"You can only type marseys!"}, 40
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
p.body_html = body_html
@ -531,7 +531,7 @@ def submit_post(v):
if v.marseyawarded and len(list(re.finditer('>[^<\s+]|[^>\s+]<', title_html))) > 0: return {"error":"You can only type marseys!"}, 40
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
if url:
if "/i.imgur.com/" in url: url = url.replace(".png", ".webp").replace(".jpg", ".webp").replace(".jpeg", ".webp")
@ -618,7 +618,7 @@ def submit_post(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
dup = g.db.query(Submission).filter(
Submission.author_id == v.id,
@ -701,7 +701,7 @@ def submit_post(v):
if v.marseyawarded and len(list(re.finditer('>[^<\s+]|[^>\s+]<', body_html))) > 0: return {"error":"You can only type marseys!"}, 400
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
if len(body_html) > 20000: return {"error":"Submission body too long!"}, 400