fix issue with text exceeding character count despite not exceeding it
parent
b6a5d010ca
commit
b602a66dd6
|
@ -163,7 +163,9 @@ def api_comment(v):
|
||||||
if parent.author_id == v.id: rts = True
|
if parent.author_id == v.id: rts = True
|
||||||
else: abort(400)
|
else: abort(400)
|
||||||
|
|
||||||
body = request.values.get("body", "").strip()[:10000]
|
body = request.values.get("body", "").strip().replace('','')
|
||||||
|
|
||||||
|
body = body.replace('\r\n', '\n')[:10000]
|
||||||
|
|
||||||
if parent_post.id not in ADMIGGERS:
|
if parent_post.id not in ADMIGGERS:
|
||||||
if v.longpost and (len(body) < 280 or ' [](' in body or body.startswith('[](')):
|
if v.longpost and (len(body) < 280 or ' [](' in body or body.startswith('[](')):
|
||||||
|
@ -644,7 +646,9 @@ def edit_comment(cid, v):
|
||||||
|
|
||||||
if c.author_id != v.id: abort(403)
|
if c.author_id != v.id: abort(403)
|
||||||
|
|
||||||
body = request.values.get("body", "").strip()[:10000]
|
body = request.values.get("body", "").strip().replace('','')
|
||||||
|
|
||||||
|
body = body.replace('\r\n', '\n')[:10000]
|
||||||
|
|
||||||
if len(body) < 1 and not (request.files.get("file") and request.headers.get("cf-ipcountry") != "T1"):
|
if len(body) < 1 and not (request.files.get("file") and request.headers.get("cf-ipcountry") != "T1"):
|
||||||
return {"error":"You have to actually type something!"}, 400
|
return {"error":"You have to actually type something!"}, 400
|
||||||
|
|
|
@ -399,7 +399,7 @@ def edit_post(pid, v):
|
||||||
|
|
||||||
body = request.values.get("body", "").strip().replace('','')
|
body = request.values.get("body", "").strip().replace('','')
|
||||||
|
|
||||||
if len(body) > 20000: return {"error":"Character limit is 20000!"}, 403
|
body = body.replace('\r\n', '\n')[:20000]
|
||||||
|
|
||||||
if v.id == p.author_id:
|
if v.id == p.author_id:
|
||||||
if v.longpost and (len(body) < 280 or ' [](' in body or body.startswith('[](')):
|
if v.longpost and (len(body) < 280 or ' [](' in body or body.startswith('[](')):
|
||||||
|
@ -717,6 +717,8 @@ def submit_post(v, sub=None):
|
||||||
|
|
||||||
body = request.values.get("body", "").strip().replace('','')
|
body = request.values.get("body", "").strip().replace('','')
|
||||||
|
|
||||||
|
body = body.replace('\r\n', '\n')[:20000]
|
||||||
|
|
||||||
def error(error):
|
def error(error):
|
||||||
if request.headers.get("Authorization") or request.headers.get("xhr"): return {"error": error}, 403
|
if request.headers.get("Authorization") or request.headers.get("xhr"): return {"error": error}, 403
|
||||||
|
|
||||||
|
@ -890,9 +892,6 @@ def submit_post(v, sub=None):
|
||||||
g.db.add(ma)
|
g.db.add(ma)
|
||||||
return redirect("/notifications")
|
return redirect("/notifications")
|
||||||
|
|
||||||
if len(str(body)) > 20000:
|
|
||||||
return error("There's a 20000 character limit for text body.")
|
|
||||||
|
|
||||||
if len(url) > 2048:
|
if len(url) > 2048:
|
||||||
return error("There's a 2048 character limit for URLs.")
|
return error("There's a 2048 character limit for URLs.")
|
||||||
|
|
||||||
|
|
|
@ -700,7 +700,9 @@ def message2(v, username):
|
||||||
@auth_required
|
@auth_required
|
||||||
def messagereply(v):
|
def messagereply(v):
|
||||||
|
|
||||||
body = request.values.get("body", "").strip()[:10000].strip()
|
body = request.values.get("body", "").strip().replace('','')
|
||||||
|
|
||||||
|
body = body.replace('\r\n', '\n')[:10000]
|
||||||
|
|
||||||
if not body and not request.files.get("file"): return {"error": "Message is empty!"}
|
if not body and not request.files.get("file"): return {"error": "Message is empty!"}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue