From a7a104348da1ac000fc8f2f289122eeecf2e3a44 Mon Sep 17 00:00:00 2001 From: Aevann Date: Sun, 12 Mar 2023 20:40:18 +0200 Subject: [PATCH] fix polls --- files/helpers/actions.py | 2 +- files/helpers/regex.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/files/helpers/actions.py b/files/helpers/actions.py index eecd4f987..a3d541ffc 100644 --- a/files/helpers/actions.py +++ b/files/helpers/actions.py @@ -509,7 +509,7 @@ def process_poll_options(v:User, target:Union[Submission, Comment]): if option_count > POLL_MAX_OPTIONS: abort(400, f"Max number of poll options is {POLL_MAX_OPTIONS}") - body = i.group(1) + body = i.group(2) if len(body) > 500: abort(400, f"Poll option body too long! (Max 500 characters)") diff --git a/files/helpers/regex.py b/files/helpers/regex.py index 40f2e8268..7b5c892bc 100644 --- a/files/helpers/regex.py +++ b/files/helpers/regex.py @@ -31,9 +31,9 @@ valid_sub_regex = re.compile("^[a-zA-Z0-9_\-]{3,25}$", flags=re.A) query_regex = re.compile("(\w+):(\S+)", flags=re.A) -poll_regex = re.compile("^\$\$([^\$\n]+)\$\$\s*(?!([^<]*<\/(code|pre|a)>|[^`]*`))", flags=re.A) -bet_regex = re.compile("^##([^\!\n]+)##\s*(?!([^<]*<\/(code|pre|a)>|[^`]*`))", flags=re.A) -choice_regex = re.compile("^&&([^\&\n]+)&&\s*(?!([^<]*<\/(code|pre|a)>|[^`]*`))", flags=re.A) +poll_regex = re.compile("(^|\n)\$\$([^\$\n]+)\$\$\s*?(?!([^<]*<\/(code|pre|a)>|[^`]*`))", flags=re.A) +bet_regex = re.compile("(^|\n)##([^\!\n]+)##\s*?(?!([^<]*<\/(code|pre|a)>|[^`]*`))", flags=re.A) +choice_regex = re.compile("(^|\n)&&([^\&\n]+)&&\s*?(?!([^<]*<\/(code|pre|a)>|[^`]*`))", flags=re.A) html_comment_regex = re.compile("", flags=re.A)