@@ -227,7 +227,8 @@ module Agents |
||
| 227 | 227 |
} |
| 228 | 228 |
when 'from', 'to', 'cc' |
| 229 | 229 |
value.present? or next true |
| 230 |
- mail.header[key].addresses.any? { |address|
|
|
| 230 |
+ header = mail.header[key] or next false |
|
| 231 |
+ header.addresses.any? { |address|
|
|
| 231 | 232 |
Array(value).any? { |pattern|
|
| 232 | 233 |
glob_match?(pattern, address) |
| 233 | 234 |
} |
@@ -183,6 +183,14 @@ describe Agents::ImapFolderAgent do |
||
| 183 | 183 |
expect { @checker.check }.not_to change { Event.count }
|
| 184 | 184 |
end |
| 185 | 185 |
|
| 186 |
+ it 'should not fail when a condition on Cc is given and a mail does not have the field' do |
|
| 187 |
+ @checker.options['conditions']['cc'] = 'John.Doe@*' |
|
| 188 |
+ |
|
| 189 |
+ expect {
|
|
| 190 |
+ expect { @checker.check }.not_to change { Event.count }
|
|
| 191 |
+ }.not_to raise_exception |
|
| 192 |
+ end |
|
| 193 |
+ |
|
| 186 | 194 |
it 'should perform regexp matching and save named captures' do |
| 187 | 195 |
@checker.options['conditions'].update( |
| 188 | 196 |
'subject' => '\ARe: (?<a>.+)', |