Adding text between <> characters renders an empty post. (Example in this post)

Hidden text below:

<OnlyTwentyCharacters>

That turns into a disallowed HTML tag and is stripped out for safety. Not a bug.

Use &lt; if you want to start your post with a < .

3 Likes

Thanks for the explaination. I thought so too.

Is there a function in discourse which simply strips disallowed html ? The usecase is,

In the Custom Wizard plugin we want to disallow a user from submitting a post whose total number of characters excluding these stripped characters is less than the minimum character limit.

Also, now thinking about it, it is relevant to discourse too. Doesn’t it make sense to disallow submission if the rendered content is less than the min character limit? I know this is quite more complex than it sounds.

When we have seen the same issue, we simply fence them with MD.

<here is the good stuff>

<here is the sweet stuff>

```<here is the good stuff>```

`<here is the sweet stuff>`

Cheaters gonna cheaṱ̴̢̧͔͓̘̫̫̣͕̻͉̩̯͙̝͈̞̼̻̱͉̘̘̮̜̝̬̻͕̯̜̦̹̜̐̐͊͒̉̄́͑̋̎́̋̃̀̆̕͜͜ͅ unicode is a big monster and there are plenty edge cases people can find to simulate blank posts that are not blank.

That is where moderation kicks in.

I am not sure if we have a hook you could use, but I guess you could prepend into StrippedLengthValidator.

I am half open to adding a hook there so you can do it without monkey patching.

5 Likes

Edited the OP as it’s getting flagged as empty by QAPage schema validation.

1 Like

@sam

We were able to get this explaination across to someone who had raised their concern, also, we’re skipping model validations in the context of Custom Wizard plugin.

But in terms of core discourse, how about disallowing submission of a post if its cooked version is less than min post length ?

I am not sure about this, it would not be intuitive to the user. There are going to be edge cases where raw is longer than cooked and it is legitimate.

4 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.