fix 500 erro
parent
ed65f92500
commit
883c96a830
|
@ -92,10 +92,10 @@ def add_options(self, body, v):
|
|||
elif o.exclusive: s = '&&'
|
||||
else: s = '$$'
|
||||
|
||||
if not o.created_utc or o.created_utc < 1677622270:
|
||||
if f'{s}{o.body_html}{s}' in body:
|
||||
body = body.replace(f'{s}{o.body_html}{s}', option_body, 1)
|
||||
elif not o.created_utc or o.created_utc < 1677622270:
|
||||
body += option_body
|
||||
else:
|
||||
body = re.sub(rf'{s} *{o.body_html} *{s}', option_body, body, count=1, flags=re.I)
|
||||
|
||||
return body
|
||||
|
||||
|
|
|
@ -278,19 +278,18 @@ def remove_cuniform(sanitized:Optional[str]) -> str:
|
|||
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("\r","").replace("\n", "")
|
||||
sanitized = remove_cuniform(sanitized)
|
||||
sanitized = remove_cuniform(sanitized).strip()
|
||||
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 = remove_cuniform(sanitized)
|
||||
sanitized = remove_cuniform(sanitized).strip()
|
||||
return sanitized[:POST_BODY_LENGTH_LIMIT(g.v) if is_post else COMMENT_BODY_LENGTH_LIMIT]
|
||||
|
||||
|
||||
|
@ -612,6 +611,9 @@ def filter_emojis_only(title, golden=True, count_emojis=False, graceful=False, s
|
|||
|
||||
title = remove_cuniform(title)
|
||||
|
||||
if strip:
|
||||
title = title.strip()
|
||||
|
||||
emojis_used = set()
|
||||
|
||||
title = render_emoji(title, emoji_regex3, golden, emojis_used)
|
||||
|
|
|
@ -396,7 +396,7 @@ def award_thing(v, thing_type, id):
|
|||
|
||||
elif kind == "flairlock":
|
||||
new_name = note[:100]
|
||||
new_name = remove_cuniform(new_name)
|
||||
new_name = remove_cuniform(new_name).strip()
|
||||
if not new_name and author.flairchanged:
|
||||
author.flairchanged += 86400
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue