strip after not before
parent
8b5bf42b54
commit
6e9d3d68dc
|
@ -194,7 +194,7 @@ def execute_snappy(post, v):
|
|||
body += addition
|
||||
archive_url(href)
|
||||
|
||||
body = body.strip()[:COMMENT_BODY_LENGTH_LIMIT]
|
||||
body = body[:COMMENT_BODY_LENGTH_LIMIT].strip()
|
||||
body_html = sanitize(body, snappy=True, showmore=True)
|
||||
|
||||
if len(body_html) == 0:
|
||||
|
|
|
@ -845,7 +845,7 @@ def shadowban(user_id, v):
|
|||
if user.admin_level > v.admin_level:
|
||||
abort(403)
|
||||
user.shadowbanned = v.id
|
||||
reason = request.values.get("reason", "").strip()[:256]
|
||||
reason = request.values.get("reason", "")[:256].strip()
|
||||
|
||||
if not reason:
|
||||
abort(400, "You need to submit a reason for shadowbanning!")
|
||||
|
@ -910,7 +910,7 @@ def admin_title_change(user_id, v):
|
|||
|
||||
user = get_account(user_id)
|
||||
|
||||
new_name=request.values.get("title").strip()[:256]
|
||||
new_name=request.values.get("title")[:256].strip()
|
||||
|
||||
user.customtitleplain=new_name
|
||||
new_name = filter_emojis_only(new_name)
|
||||
|
@ -982,7 +982,7 @@ def ban_user(fullname, v):
|
|||
if days < 0:
|
||||
abort(400, "You can't bans people for negative days!")
|
||||
|
||||
reason = request.values.get("reason", "").strip()[:256]
|
||||
reason = request.values.get("reason", "")[:256].strip()
|
||||
|
||||
if not reason:
|
||||
abort(400, "You need to submit a reason for banning!")
|
||||
|
|
|
@ -229,7 +229,7 @@ def comment(v):
|
|||
abort(415)
|
||||
|
||||
body = body.replace('\n ', '\n').replace('\r', '')
|
||||
body = body.strip()[:COMMENT_BODY_LENGTH_LIMIT].strip()
|
||||
body = body[:COMMENT_BODY_LENGTH_LIMIT].strip()
|
||||
|
||||
if v.admin_level >= PERMS['USE_ADMIGGER_THREADS'] and posting_to_post and post_target.id == SNAPPY_THREAD and level == 1:
|
||||
with open(f"snappy_{SITE_NAME}.txt", "r+", encoding="utf-8") as f:
|
||||
|
@ -631,7 +631,7 @@ def edit_comment(cid, v):
|
|||
execute_antispam_comment_check(body, v)
|
||||
|
||||
body = process_files(request.files, v, body)
|
||||
body = body.strip()[:COMMENT_BODY_LENGTH_LIMIT] # process_files potentially adds characters to the post
|
||||
body = body[:COMMENT_BODY_LENGTH_LIMIT].strip() # process_files potentially adds characters to the post
|
||||
|
||||
body_for_sanitize = body
|
||||
if v.owoify:
|
||||
|
|
|
@ -564,7 +564,7 @@ def submit_post(v, sub=None):
|
|||
abort(400, "There's a 2048 character limit for URLs!")
|
||||
|
||||
body = process_files(request.files, v, body)
|
||||
body = body.strip()[:POST_BODY_LENGTH_LIMIT(v)] # process_files() adds content to the body, so we need to re-strip
|
||||
body = body[:POST_BODY_LENGTH_LIMIT(v)].strip() # process_files() adds content to the body, so we need to re-strip
|
||||
|
||||
body_html = sanitize(body, count_emojis=True, limit_pings=100)
|
||||
|
||||
|
@ -1060,7 +1060,7 @@ def edit_post(pid, v):
|
|||
p.title_html = title_html
|
||||
|
||||
body = process_files(request.files, v, body)
|
||||
body = body.strip()[:POST_BODY_LENGTH_LIMIT(v)] # process_files() may be adding stuff to the body
|
||||
body = body[:POST_BODY_LENGTH_LIMIT(v)].strip() # process_files() may be adding stuff to the body
|
||||
|
||||
if body != p.body:
|
||||
body_html = sanitize(body, golden=False, limit_pings=100)
|
||||
|
|
|
@ -623,7 +623,7 @@ def settings_css_get(v):
|
|||
@auth_required
|
||||
def settings_css(v):
|
||||
if v.chud: abort(400, "Chuded users can't edit CSS!")
|
||||
css = request.values.get("css", v.css).strip().replace('\\', '').strip()[:CSS_LENGTH_LIMIT]
|
||||
css = request.values.get("css", v.css).strip().replace('\\', '')[:CSS_LENGTH_LIMIT].strip()
|
||||
v.css = css
|
||||
g.db.add(v)
|
||||
|
||||
|
@ -636,7 +636,7 @@ def settings_css(v):
|
|||
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400, key_func=get_ID)
|
||||
@auth_required
|
||||
def settings_profilecss(v):
|
||||
profilecss = request.values.get("profilecss", v.profilecss).strip().replace('\\', '').strip()[:CSS_LENGTH_LIMIT]
|
||||
profilecss = request.values.get("profilecss", v.profilecss).replace('\\', '')[:CSS_LENGTH_LIMIT].strip()
|
||||
valid, error = validate_css(profilecss)
|
||||
if not valid:
|
||||
return render_template("settings/css.html", error=error, v=v, profilecss=profilecss)
|
||||
|
|
|
@ -454,7 +454,7 @@ def post_sub_sidebar(v, sub):
|
|||
if not v.mods(sub.name): abort(403)
|
||||
if v.shadowbanned: return redirect(f'/h/{sub}/settings')
|
||||
|
||||
sub.sidebar = request.values.get('sidebar', '').strip()[:10000]
|
||||
sub.sidebar = request.values.get('sidebar', '')[:10000].strip()
|
||||
sidebar_html = sanitize(sub.sidebar, blackjack=f"/h/{sub} sidebar")
|
||||
|
||||
if len(sidebar_html) > 20000:
|
||||
|
|
|
@ -626,7 +626,7 @@ def message2(v, username=None, id=None):
|
|||
|
||||
if not g.is_tor and get_setting("dm_media"):
|
||||
body = process_files(request.files, v, body, is_dm=True, dm_user=user)
|
||||
body = body.strip()[:COMMENT_BODY_LENGTH_LIMIT] #process_files potentially adds characters to the post
|
||||
body = body[:COMMENT_BODY_LENGTH_LIMIT].strip() #process_files potentially adds characters to the post
|
||||
|
||||
if not body: abort(400, "Message is empty!")
|
||||
|
||||
|
@ -708,7 +708,7 @@ def messagereply(v):
|
|||
|
||||
if not g.is_tor and get_setting("dm_media"):
|
||||
body = process_files(request.files, v, body, is_dm=True, dm_user=user)
|
||||
body = body.strip()[:COMMENT_BODY_LENGTH_LIMIT] #process_files potentially adds characters to the post
|
||||
body = body[:COMMENT_BODY_LENGTH_LIMIT].strip() #process_files potentially adds characters to the post
|
||||
|
||||
if not body: abort(400, "Message is empty!")
|
||||
|
||||
|
|
Loading…
Reference in New Issue