Commit 4aa5e79c authored by Peter Leitzen's avatar Peter Leitzen

Simplify regexp for splitting recipients

This fixes the warning: character class has duplicated range

With this change we're also accepting a single carriage return
as a separator.
parent ac5c5fb3
......@@ -100,6 +100,6 @@ class PipelinesEmailService < Service
end
def retrieve_recipients(data)
recipients.to_s.split(/[,(?:\r?\n) ]+/).reject(&:empty?)
recipients.to_s.split(/[,\r\n ]+/).reject(&:empty?)
end
end
......@@ -305,8 +305,8 @@ describe PipelinesEmailService, :mailer do
end
context 'with recipients list separating with newlines' do
let(:recipients) { "\ntest@gitlab.com, \r\nexample@gitlab.com" }
let(:receivers) { %w[test@gitlab.com example@gitlab.com] }
let(:recipients) { "\ntest@gitlab.com, \r\nexample@gitlab.com\rother@gitlab.com" }
let(:receivers) { %w[test@gitlab.com example@gitlab.com other@gitlab.com] }
context 'with failed pipeline' do
before do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment