restore needful .strip()

pull/173/head
Aevann 2023-07-29 22:17:50 +03:00
parent 6272367c1b
commit e1853befaa
3 changed files with 8 additions and 8 deletions

View File

@ -153,7 +153,7 @@ def comment(v:User):
if level > COMMENT_MAX_DEPTH: abort(400, f"Max comment level is {COMMENT_MAX_DEPTH}")
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 v.longpost and (len(body) < 280 or ' [](' in body or body.startswith('[](')):
@ -614,7 +614,7 @@ def edit_comment(cid, v):
abort(403)
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):
abort(400, "You have to actually type something!")

View File

@ -465,10 +465,10 @@ def submit_post(v:User, sub=None):
if '\\' in url: abort(400)
title = request.values.get("title", "")
title = title[:POST_TITLE_LENGTH_LIMIT]
title = title[:POST_TITLE_LENGTH_LIMIT].strip()
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)))
@ -1042,10 +1042,10 @@ def edit_post(pid, v):
abort(403, "You can't edit posts older than 1 week!")
title = request.values.get("title", "")
title = title[:POST_TITLE_LENGTH_LIMIT]
title = title[:POST_TITLE_LENGTH_LIMIT].strip()
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.longpost and (len(body) < 280 or ' [](' in body or body.startswith('[](')):

View File

@ -623,7 +623,7 @@ def message2(v, username=None, id=None):
abort(403, f"@{user.username} is blocking you!")
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"):
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
def messagereply(v:User):
body = request.values.get("body", "")
body = body[:COMMENT_BODY_LENGTH_LIMIT]
body = body[:COMMENT_BODY_LENGTH_LIMIT].strip()
id = request.values.get("parent_id")
parent = get_comment(id, v=v)