regular expression that we use to separate values by comma was updated
to take into account only commas outside quoted strings
record_line :aliases, fields: ['name', 'recipient'], separator: %r{\s*:\s*}, block_eval: :instance do
def post_parse(record)
if record[:recipient]
- record[:recipient] = record[:recipient].split(%r{\s*,\s*}).map { |d| d.gsub(%r{^['"]|['"]$}, '') }
+ record[:recipient] = record[:recipient].split(%r{\s*,\s*(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)}).map { |d| d.gsub(%r{^['"]|['"]$}, '') }
end
record
end
# Other tests
anothertest: "|/path/to/rt-mailgate --queue 'another test' --action correspond --url http://my.com/"
test: "|/path/to/rt-mailgate --queue 'test' --action correspond --url http://my.com/"
+commas_in_command_test: "|/path/to/rt-mailgate --queue 'test' --action correspond --url http://my.com/ --projects projecta,projectb"
# Included file
incfile: :include: /tmp/somefile