forked from MarseyWorld/MarseyWorld
dedup removing cuniform
parent
0f6b36f40b
commit
7f565f5457
|
@ -273,19 +273,24 @@ def with_sigalrm_timeout(timeout: int):
|
|||
return wrapped
|
||||
return inner
|
||||
|
||||
def remove_cuniform(sanitized:Optional[str]) -> str:
|
||||
if not sanitized: return ""
|
||||
sanitized = sanitized.replace('\u200e','').replace('\u200b','').replace('\u202e','').replace("\ufeff", "")
|
||||
sanitized = sanitized.replace("𒐪","").replace("𒐫","").replace("﷽","")
|
||||
sanitized = sanitized.replace("\r\n", "\n")
|
||||
sanitized = sanitized.strip()
|
||||
return sanitized
|
||||
|
||||
def sanitize_raw_title(sanitized:Optional[str]) -> str:
|
||||
if not sanitized: return ""
|
||||
sanitized = sanitized.replace('\u200e','').replace('\u200b','').replace("\ufeff", "").replace("\r","").replace("\n", "").replace("𒐫", "").replace('\u202e','')
|
||||
sanitized = sanitized.strip()
|
||||
sanitized = sanitized.replace("\r","").replace("\n", "")
|
||||
sanitized = remove_cuniform(sanitized)
|
||||
return sanitized[:POST_TITLE_LENGTH_LIMIT]
|
||||
|
||||
def sanitize_raw_body(sanitized:Optional[str], is_post:bool) -> str:
|
||||
if not sanitized: return ""
|
||||
sanitized = html_comment_regex.sub('', sanitized)
|
||||
|
||||
sanitized = sanitized.replace('\u200e','').replace('\u200b','').replace("\ufeff", "").replace("\r\n", "\n").replace("𒐫", "").replace('\u202e','')
|
||||
sanitized = sanitized.strip()
|
||||
sanitized = remove_cuniform(sanitized)
|
||||
return sanitized[:POST_BODY_LENGTH_LIMIT(g.v) if is_post else COMMENT_BODY_LENGTH_LIMIT]
|
||||
|
||||
|
||||
|
@ -600,7 +605,9 @@ def allowed_attributes_emojis(tag, name, value):
|
|||
@with_sigalrm_timeout(1)
|
||||
def filter_emojis_only(title, golden=True, count_emojis=False, graceful=False, strip=True):
|
||||
|
||||
title = title.replace('','').replace('','').replace("\ufeff", "").replace("𒐪","").replace("\n", "").replace("\r", "").replace("\t", "").replace('<','<').replace('>','>').replace("﷽","")
|
||||
title = title.replace("\n", "").replace("\r", "").replace("\t", "").replace('<','<').replace('>','>')
|
||||
|
||||
title = remove_cuniform(title)
|
||||
|
||||
emojis_used = set()
|
||||
|
||||
|
|
|
@ -337,7 +337,8 @@ def award_thing(v, thing_type, id):
|
|||
|
||||
badge_grant(user=author, badge_id=58)
|
||||
elif kind == "flairlock":
|
||||
new_name = note[:100].replace("𒐪","").replace("﷽","").strip()
|
||||
new_name = note[:100]
|
||||
new_name = remove_cuniform(new_name)
|
||||
if not new_name and author.flairchanged:
|
||||
author.flairchanged += 86400
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue