Hi, there is a bug with Chat that allows you to send empty messages which only contain spaces. I have looked through settings but cannot find anything that would help me. Thanks
3 Likes
sam
(Sam Saffron)
May 22, 2023, 6:53am
2
Legit… this is an oversight and certainly looks odd… we should ban “blank” both server side and client side.
Blank is a tricky animal
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>`
Hi there, I just installed discourse and found out that it didn’t support Zero Width Space at all. It is Khmer Unicode special character that represents a hidden space to separate each word. you can take a look here http://www.askcambodia.org/t/angelababy/21
@@whitespaces_regexp =
Regexp.new(
"(\u00A0|\u1680|\u180E|[\u2000-\u200A]|\u2028|\u2029|\u202F|\u205F|\u3000)",
Regexp::IGNORECASE,
).freeze
def self.normalize_whitespaces(text)
text&.gsub(@@whitespaces_regexp, " ")
end
Recommend we just use our text cleaner here server side as well to ensure people don’t cheat themselves as well.
4 Likes
We have fixed this in this commit:
committed 06:06AM - 08 Jun 23 UTC
This fixes an issue where a user could send an empty
string as a chat message .… e.g ' ' and the message would
be posted. We don't want this, we need to strip the message
first before validating for length etc.
Thanks!
6 Likes