summaryrefslogtreecommitdiff
path: root/lib/gitlab/incoming_email.rb
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2017-01-17 14:50:49 -0500
committerLin Jen-Shin <godfat@godfat.org>2017-01-20 20:19:22 +0800
commitd15b7db1216f220b9f5af7e777cf04712483cbdf (patch)
tree697452bdb1490c95596a9b2419e62e2e2af7d28e /lib/gitlab/incoming_email.rb
parent491f1375fc055805c623a3079a383de988689f3d (diff)
downloadgitlab-ce-d15b7db1216f220b9f5af7e777cf04712483cbdf.tar.gz
Fix References header parser for Microsoft Exchange
Microsoft Exchange would append a comma and another message id into the References header, therefore we'll need to fallback and parse the header by ourselves. Closes #26567
Diffstat (limited to 'lib/gitlab/incoming_email.rb')
-rw-r--r--lib/gitlab/incoming_email.rb9
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/gitlab/incoming_email.rb b/lib/gitlab/incoming_email.rb
index 801dfde9a36..9ae3a2c1214 100644
--- a/lib/gitlab/incoming_email.rb
+++ b/lib/gitlab/incoming_email.rb
@@ -3,8 +3,6 @@ module Gitlab
WILDCARD_PLACEHOLDER = '%{key}'.freeze
class << self
- FALLBACK_MESSAGE_ID_REGEX = /\Areply\-(.+)@#{Gitlab.config.gitlab.host}\Z/.freeze
-
def enabled?
config.enabled && config.address
end
@@ -32,10 +30,11 @@ module Gitlab
end
def key_from_fallback_message_id(mail_id)
- match = mail_id.match(FALLBACK_MESSAGE_ID_REGEX)
- return unless match
+ mail_id[/\Areply\-(.+)@#{Gitlab.config.gitlab.host}\z/, 1]
+ end
- match[1]
+ def scan_fallback_references(references)
+ references.scan(/(?!<)[^<>]+(?=>)/.freeze)
end
def config