Unable to create poll when the last poll option starts with hashtag

AI-generated summary

A bug was discovered where creating a poll in Discourse fails when the last poll option starts with a # symbol. This issue was encountered during an import from an old phpbb3 forum. The poll plugin has problems with certain text that looks like markdown, including numbered lists.

To work around this issue, users can escape the problematic symbols by prepending \ to it, like this:

[poll]
- 1
- \#2
[/poll]

The issue has been deferred to #markdown-it-review::tag for further review, but a temporary fix has been implemented, allowing polls with # symbols as options to work correctly again, as demonstrated by sam.

It’s not possible to create polls when the last poll option starts with a #.
@anon36895752 discovered this bug.

This works:

[poll]
- #1
- 2
[/poll]

This doesn’t work:

[poll]
- 1
- #2
[/poll]
5개의 좋아요

Ok but.. why should this matter? I agree it is a bug, but .. don’t do that? :wink:

It came from an import from an old phpbb3 forum. I had no idea what was crashing the importer script until i started editing files and printing stuff all over the place. I’m fine with the importer just skipping the poll, but hard crashing isn’t a super great solution, especially for people who are new to discourse and are migrating from phpbb and have absolutely no clue where to start looking for the problem.

I agree, the importer shouldn’t crash and I’ll fix that.
But the real issue is that the poll plugin has problems with certain text that looks like markdown.

This has problems too:

[poll]
- 24. November
- 26. November
[/poll]

There’s no problem when the last option doesn’t look like a numbered list:

[poll]
- 24. November
- 26. November
- some other date
[/poll]

Of course, that’s an option. :wink: But I guess documenting the issues is a better solution.

In case someone else stumbles upon the same problems, here’s an easy workaround: Escape the problematic symbols in the poll options by prepending \ to it. The following examples work:

[poll]
- 1
- \#2
[/poll]

[poll]
- 24. November
- 26\. November
[/poll]
5개의 좋아요

Would you mind tagging this topic with poll ?

This is triggering a JavaScript error @tgxworld so it is worth fixing, if possible (at least stop console from filling with errors)

If too hard we can defer on markdown-it-review

4개의 좋아요

Let’s defer it to markdown-it-review, this is a bug in better-markdown.js where the following is generated incorrectly.

5개의 좋아요

Yay this works now:

  • 1
  • #2
0 voters
4개의 좋아요