diff --git a/files/routes/comments.py b/files/routes/comments.py index 5dc148383..7c71fc6b6 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -132,12 +132,12 @@ def comment(v): abort(403, "You can't reply to users who have blocked you or users that you have blocked.") options = [] - for i in poll_regex.finditer(body): + for i in list(poll_regex.finditer(body))[:10]: options.append(i.group(1)) body = body.replace(i.group(0), "") choices = [] - for i in choice_regex.finditer(body): + for i in list(choice_regex.finditer(body))[:10]: choices.append(i.group(1)) body = body.replace(i.group(0), "") @@ -390,7 +390,7 @@ def edit_comment(cid, v): elif v.bird and len(body) > 140: abort(403, "You have to type less than 140 characters!") - for i in poll_regex.finditer(body): + for i in list(poll_regex.finditer(body))[:10]: body = body.replace(i.group(0), "") body_html = filter_emojis_only(i.group(1)) if len(body_html) > 500: abort(400, "Poll option too long!") @@ -401,7 +401,7 @@ def edit_comment(cid, v): ) g.db.add(option) - for i in choice_regex.finditer(body): + for i in list(choice_regex.finditer(body))[:10]: body = body.replace(i.group(0), "") body_html = filter_emojis_only(i.group(1)) if len(body_html) > 500: abort(400, "Poll option too long!") diff --git a/files/routes/posts.py b/files/routes/posts.py index a6068efbd..987eabdad 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -360,7 +360,7 @@ def edit_post(pid, v): ) g.db.add(bet) - for i in poll_regex.finditer(body): + for i in list(poll_regex.finditer(body))[:10]: body = body.replace(i.group(0), "") body_html = filter_emojis_only(i.group(1)) if len(body_html) > 500: abort(400, "Poll option too long!") @@ -371,7 +371,7 @@ def edit_post(pid, v): ) g.db.add(option) - for i in choice_regex.finditer(body): + for i in list(choice_regex.finditer(body))[:10]: body = body.replace(i.group(0), "") body_html = filter_emojis_only(i.group(1)) if len(body_html) > 500: abort(400, "Poll option too long!") @@ -754,12 +754,12 @@ def submit_post(v, sub=None): body = body.replace(i.group(0), "") options = [] - for i in poll_regex.finditer(body): + for i in list(poll_regex.finditer(body))[:10]: options.append(i.group(1)) body = body.replace(i.group(0), "") choices = [] - for i in choice_regex.finditer(body): + for i in list(choice_regex.finditer(body))[:10]: choices.append(i.group(1)) body = body.replace(i.group(0), "")