summaryrefslogtreecommitdiff
path: root/lib/gitlab/email/reply_parser.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/email/reply_parser.rb')
-rw-r--r--lib/gitlab/email/reply_parser.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/gitlab/email/reply_parser.rb b/lib/gitlab/email/reply_parser.rb
index 96d0a4f5153..971afe4a878 100644
--- a/lib/gitlab/email/reply_parser.rb
+++ b/lib/gitlab/email/reply_parser.rb
@@ -18,6 +18,10 @@ module Gitlab
# not using /\s+$/ here because that deletes empty lines
body = body.gsub(/[ \t]$/, '')
+ # TODO [jneen]: do we want to allow empty-quoting? (replies only containing a blockquote)
+ # EmailReplyTrimmer allows this as a special case, so we detect it manually here.
+ return "" if body.lines.all? { |l| l.strip.empty? || l.start_with?('>') }
+
body.force_encoding(encoding).encode("UTF-8")
end