mirror of
https://github.com/discourse/discourse.git
synced 2025-09-06 10:50:21 +08:00
FEATURE: backport a minimal String#scrub
BUGFIX: invalid byte sequence in email would explode all processing
This commit is contained in:
parent
81eec5ff06
commit
9738c4ff48
3 changed files with 19 additions and 10 deletions
|
@ -94,10 +94,10 @@ module Email
|
|||
end
|
||||
|
||||
def discourse_email_parser
|
||||
lines = @body.lines.to_a
|
||||
lines = @body.scrub.lines.to_a
|
||||
range_end = 0
|
||||
|
||||
email_year = lines.each_with_index do |l, idx|
|
||||
lines.each_with_index do |l, idx|
|
||||
break if l =~ /\A\s*\-{3,80}\s*\z/ ||
|
||||
l =~ Regexp.new("\\A\\s*" + I18n.t('user_notifications.previous_discussion') + "\\s*\\Z") ||
|
||||
(l =~ /via #{SiteSetting.title}(.*)\:$/) ||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue