forked from rDrama/rDrama
restore needful .strip()
parent
6272367c1b
commit
e1853befaa
|
@ -153,7 +153,7 @@ def comment(v:User):
|
||||||
if level > COMMENT_MAX_DEPTH: abort(400, f"Max comment level is {COMMENT_MAX_DEPTH}")
|
if level > COMMENT_MAX_DEPTH: abort(400, f"Max comment level is {COMMENT_MAX_DEPTH}")
|
||||||
|
|
||||||
body = request.values.get("body", "")
|
body = request.values.get("body", "")
|
||||||
body = body[:COMMENT_BODY_LENGTH_LIMIT]
|
body = body[:COMMENT_BODY_LENGTH_LIMIT].strip()
|
||||||
|
|
||||||
if not posting_to_post or post_target.id not in ADMIGGER_THREADS:
|
if not posting_to_post or post_target.id not in ADMIGGER_THREADS:
|
||||||
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('[](')):
|
||||||
|
@ -614,7 +614,7 @@ def edit_comment(cid, v):
|
||||||
abort(403)
|
abort(403)
|
||||||
|
|
||||||
body = request.values.get("body", "")
|
body = request.values.get("body", "")
|
||||||
body = body[:COMMENT_BODY_LENGTH_LIMIT]
|
body = body[:COMMENT_BODY_LENGTH_LIMIT].strip()
|
||||||
|
|
||||||
if len(body) < 1 and not (request.files.get("file") and not g.is_tor):
|
if len(body) < 1 and not (request.files.get("file") and not g.is_tor):
|
||||||
abort(400, "You have to actually type something!")
|
abort(400, "You have to actually type something!")
|
||||||
|
|
|
@ -465,10 +465,10 @@ def submit_post(v:User, sub=None):
|
||||||
if '\\' in url: abort(400)
|
if '\\' in url: abort(400)
|
||||||
|
|
||||||
title = request.values.get("title", "")
|
title = request.values.get("title", "")
|
||||||
title = title[:POST_TITLE_LENGTH_LIMIT]
|
title = title[:POST_TITLE_LENGTH_LIMIT].strip()
|
||||||
|
|
||||||
body = request.values.get("body", "")
|
body = request.values.get("body", "")
|
||||||
body = body[:POST_BODY_LENGTH_LIMIT(g.v)]
|
body = body[:POST_BODY_LENGTH_LIMIT(g.v)].strip()
|
||||||
|
|
||||||
post_ping_group_count = len(list(group_mention_regex.finditer(body)))
|
post_ping_group_count = len(list(group_mention_regex.finditer(body)))
|
||||||
|
|
||||||
|
@ -1042,10 +1042,10 @@ def edit_post(pid, v):
|
||||||
abort(403, "You can't edit posts older than 1 week!")
|
abort(403, "You can't edit posts older than 1 week!")
|
||||||
|
|
||||||
title = request.values.get("title", "")
|
title = request.values.get("title", "")
|
||||||
title = title[:POST_TITLE_LENGTH_LIMIT]
|
title = title[:POST_TITLE_LENGTH_LIMIT].strip()
|
||||||
|
|
||||||
body = request.values.get("body", "")
|
body = request.values.get("body", "")
|
||||||
body = body[:POST_BODY_LENGTH_LIMIT(g.v)]
|
body = body[:POST_BODY_LENGTH_LIMIT(g.v)].strip()
|
||||||
|
|
||||||
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('[](')):
|
||||||
|
|
|
@ -623,7 +623,7 @@ def message2(v, username=None, id=None):
|
||||||
abort(403, f"@{user.username} is blocking you!")
|
abort(403, f"@{user.username} is blocking you!")
|
||||||
|
|
||||||
body = request.values.get("message", "")
|
body = request.values.get("message", "")
|
||||||
body = body[:COMMENT_BODY_LENGTH_LIMIT]
|
body = body[:COMMENT_BODY_LENGTH_LIMIT].strip()
|
||||||
|
|
||||||
if not g.is_tor and get_setting("dm_media"):
|
if not g.is_tor and get_setting("dm_media"):
|
||||||
body = process_files(request.files, v, body, is_dm=True, dm_user=user)
|
body = process_files(request.files, v, body, is_dm=True, dm_user=user)
|
||||||
|
@ -679,7 +679,7 @@ def message2(v, username=None, id=None):
|
||||||
@auth_required
|
@auth_required
|
||||||
def messagereply(v:User):
|
def messagereply(v:User):
|
||||||
body = request.values.get("body", "")
|
body = request.values.get("body", "")
|
||||||
body = body[:COMMENT_BODY_LENGTH_LIMIT]
|
body = body[:COMMENT_BODY_LENGTH_LIMIT].strip()
|
||||||
|
|
||||||
id = request.values.get("parent_id")
|
id = request.values.get("parent_id")
|
||||||
parent = get_comment(id, v=v)
|
parent = get_comment(id, v=v)
|
||||||
|
|
Loading…
Reference in New Issue