Optional regex for filtering attachments on incoming emails (#27025).

Patch by Jan Schulz-Hofen.


git-svn-id: http://svn.redmine.org/redmine/trunk@17225 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Go MAEDA
2018-03-03 04:29:54 +00:00
parent 03c8fc5103
commit 76f12c1316
6 changed files with 34 additions and 9 deletions

View File

@@ -1053,6 +1053,16 @@ class MailHandlerTest < ActiveSupport::TestCase
end
end
def test_attachments_that_match_mail_handler_excluded_filenames_by_regex_should_be_ignored
with_settings :mail_handler_excluded_filenames => '.+\.vcf,(pa|nut)ella\.jpg',
:mail_handler_enable_regex_excluded_filenames => 1 do
issue = submit_email('ticket_with_attachment.eml', :issue => {:project => 'onlinestore'})
assert issue.is_a?(Issue)
assert !issue.new_record?
assert_equal 0, issue.reload.attachments.size
end
end
def test_attachments_that_do_not_match_mail_handler_excluded_filenames_should_be_attached
with_settings :mail_handler_excluded_filenames => '*.vcf, *.gif' do
issue = submit_email('ticket_with_attachment.eml', :issue => {:project => 'onlinestore'})