mirror of
https://github.com/discourse/discourse.git
synced 2025-09-05 08:59:27 +08:00
FIX: null bytes in user input should not cause post creation to fail
This commit is contained in:
parent
c493f82907
commit
714f841f0a
2 changed files with 12 additions and 0 deletions
|
@ -54,9 +54,15 @@ class PostCreator
|
|||
# If we don't do this we introduce a rather risky dependency
|
||||
@user = user
|
||||
@opts = opts || {}
|
||||
pg_clean_up!(opts[:title])
|
||||
pg_clean_up!(opts[:raw])
|
||||
@spam = false
|
||||
end
|
||||
|
||||
def pg_clean_up!(str)
|
||||
str.gsub!("\u0000", "") if str
|
||||
end
|
||||
|
||||
# True if the post was considered spam
|
||||
def spam?
|
||||
@spam
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue