forked from rDrama/rDrama
dont strip poll options
parent
e6a802f12d
commit
65542b5fac
|
@ -524,7 +524,7 @@ def process_poll_options(v:User, target:Union[Submission, Comment]):
|
||||||
else:
|
else:
|
||||||
cls = CommentOption
|
cls = CommentOption
|
||||||
|
|
||||||
body_html=filter_emojis_only(body)
|
body_html=filter_emojis_only(body, strip=False) #dont strip cuz ppl sometimes leave spaces before && or after it, which breaks the replacing logic
|
||||||
|
|
||||||
existing = g.db.query(cls).filter_by(
|
existing = g.db.query(cls).filter_by(
|
||||||
parent_id=target.id,
|
parent_id=target.id,
|
||||||
|
|
|
@ -546,13 +546,11 @@ def allowed_attributes_emojis(tag, name, value):
|
||||||
|
|
||||||
|
|
||||||
@with_sigalrm_timeout(1)
|
@with_sigalrm_timeout(1)
|
||||||
def filter_emojis_only(title, golden=True, count_emojis=False, graceful=False, torture=False):
|
def filter_emojis_only(title, golden=True, count_emojis=False, graceful=False, torture=False, strip=True):
|
||||||
title = title.strip()
|
|
||||||
|
|
||||||
if torture:
|
if torture:
|
||||||
title = torture_ap(title, g.v.username)
|
title = torture_ap(title, g.v.username)
|
||||||
|
|
||||||
title = title.replace('','').replace('','').replace("\ufeff", "").replace("𒐪","").replace("\n", "").replace("\r", "").replace("\t", "").replace('<','<').replace('>','>').replace("﷽","").strip()
|
title = title.replace('','').replace('','').replace("\ufeff", "").replace("𒐪","").replace("\n", "").replace("\r", "").replace("\t", "").replace('<','<').replace('>','>').replace("﷽","")
|
||||||
|
|
||||||
emojis_used = set()
|
emojis_used = set()
|
||||||
|
|
||||||
|
@ -565,7 +563,10 @@ def filter_emojis_only(title, golden=True, count_emojis=False, graceful=False, t
|
||||||
|
|
||||||
title = strikethrough_regex.sub(r'\1<del>\2</del>', title)
|
title = strikethrough_regex.sub(r'\1<del>\2</del>', title)
|
||||||
|
|
||||||
title = bleach.clean(title, tags=['img','del','span'], attributes=allowed_attributes_emojis, protocols=['http','https']).replace('\n','').strip()
|
title = bleach.clean(title, tags=['img','del','span'], attributes=allowed_attributes_emojis, protocols=['http','https']).replace('\n','')
|
||||||
|
|
||||||
|
if strip:
|
||||||
|
title = title.strip()
|
||||||
|
|
||||||
if len(title) > POST_TITLE_HTML_LENGTH_LIMIT and not graceful: abort(400)
|
if len(title) > POST_TITLE_HTML_LENGTH_LIMIT and not graceful: abort(400)
|
||||||
else: return title
|
else: return title
|
||||||
|
|
Loading…
Reference in New Issue