From 50439f988f2868b9f206d56635ea7746035fe849 Mon Sep 17 00:00:00 2001 From: Aevann Date: Wed, 6 Sep 2023 21:14:07 +0300 Subject: [PATCH] remove graceful=True from filter_emojis_only cuz its not useful at all --- files/helpers/sanitize.py | 6 +++--- files/routes/posts.py | 4 +--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/files/helpers/sanitize.py b/files/helpers/sanitize.py index af6c1931b..84ef4fceb 100644 --- a/files/helpers/sanitize.py +++ b/files/helpers/sanitize.py @@ -699,7 +699,7 @@ def allowed_attributes_emojis(tag, name, value): @with_sigalrm_timeout(2) -def filter_emojis_only(title, golden=True, count_emojis=False, graceful=False): +def filter_emojis_only(title, golden=True, count_emojis=False): title = title.replace("\n", "").replace("\r", "").replace("\t", "").replace('<','<').replace('>','>') @@ -718,8 +718,8 @@ def filter_emojis_only(title, golden=True, count_emojis=False, graceful=False): title = bleach.clean(title, tags=['img','del','span'], attributes=allowed_attributes_emojis, protocols=['http','https']).replace('\n','') - if len(title) > POST_TITLE_HTML_LENGTH_LIMIT and not graceful: - abort(400) + if len(title) > POST_TITLE_HTML_LENGTH_LIMIT: + abort(400, "Rendered title is too big!") title = title.strip() diff --git a/files/routes/posts.py b/files/routes/posts.py index f9d0c4b59..99a8bee49 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -432,12 +432,10 @@ def submit_post(v, sub=None): if SITE == 'rdrama.net' and v.id == 10947: sub = 'mnn' - title_html = filter_emojis_only(title, graceful=True, count_emojis=True) + title_html = filter_emojis_only(title, count_emojis=True) if v.marseyawarded and not marseyaward_title_regex.fullmatch(title_html): abort(400, "You can only type marseys!") - if len(title_html) > POST_TITLE_HTML_LENGTH_LIMIT: - abort(400, "Rendered title is too big!") if sub == 'changelog': abort(400, "/h/changelog is archived")