2
0
Fork 0
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:
Sam 2015-08-19 12:15:38 +10:00
parent c493f82907
commit 714f841f0a
2 changed files with 12 additions and 0 deletions

View file

@ -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