summaryrefslogtreecommitdiffstats
path: root/app/models/mail_handler.rb
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2018-03-03 04:29:54 +0000
committerGo MAEDA <maeda@farend.jp>2018-03-03 04:29:54 +0000
commit76f12c1316ebcf93bc86ccd449b6032c378cc760 (patch)
tree65c3cf6726b3c3a048d296dbeaa1dc10f158e7ec /app/models/mail_handler.rb
parent03c8fc51033ed68920bd74e6caf21d51a2db6f9f (diff)
downloadredmine-76f12c1316ebcf93bc86ccd449b6032c378cc760.tar.gz
redmine-76f12c1316ebcf93bc86ccd449b6032c378cc760.zip
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
Diffstat (limited to 'app/models/mail_handler.rb')
-rwxr-xr-xapp/models/mail_handler.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/app/models/mail_handler.rb b/app/models/mail_handler.rb
index 518e8c84b..0231d84db 100755
--- a/app/models/mail_handler.rb
+++ b/app/models/mail_handler.rb
@@ -310,7 +310,11 @@ class MailHandler < ActionMailer::Base
def accept_attachment?(attachment)
@excluded ||= Setting.mail_handler_excluded_filenames.to_s.split(',').map(&:strip).reject(&:blank?)
@excluded.each do |pattern|
+ if Setting.mail_handler_enable_regex_excluded_filenames?
+ regexp = %r{\A#{pattern}\z}i
+ else
regexp = %r{\A#{Regexp.escape(pattern).gsub("\\*", ".*")}\z}i
+ end
if attachment.filename.to_s =~ regexp
logger.info "MailHandler: ignoring attachment #{attachment.filename} matching #{pattern}"
return false