summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xapp/models/mail_handler.rb2
-rw-r--r--app/models/setting.rb24
2 files changed, 13 insertions, 13 deletions
diff --git a/app/models/mail_handler.rb b/app/models/mail_handler.rb
index 0231d84db..c158435a9 100755
--- a/app/models/mail_handler.rb
+++ b/app/models/mail_handler.rb
@@ -313,7 +313,7 @@ class MailHandler < ActionMailer::Base
if Setting.mail_handler_enable_regex_excluded_filenames?
regexp = %r{\A#{pattern}\z}i
else
- regexp = %r{\A#{Regexp.escape(pattern).gsub("\\*", ".*")}\z}i
+ 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}"
diff --git a/app/models/setting.rb b/app/models/setting.rb
index d66470d0a..fa04f1c1a 100644
--- a/app/models/setting.rb
+++ b/app/models/setting.rb
@@ -147,22 +147,22 @@ class Setting < ActiveRecord::Base
[:mail_handler_enable_regex_excluded_filenames, :mail_handler_excluded_filenames, /\s*,\s*/]
].each do |enable_regex, regex_field, delimiter|
- if settings.key?(regex_field) || settings.key?(enable_regex)
- regexp = Setting.send("#{enable_regex}?")
- if settings.key?(enable_regex)
- regexp = settings[enable_regex].to_s != '0'
- end
- if regexp
- settings[regex_field].to_s.split(delimiter).each do |value|
- begin
- Regexp.new(value)
- rescue RegexpError => e
- messages << [regex_field, "#{l('activerecord.errors.messages.not_a_regexp')} (#{e.message})"]
+ if settings.key?(regex_field) || settings.key?(enable_regex)
+ regexp = Setting.send("#{enable_regex}?")
+ if settings.key?(enable_regex)
+ regexp = settings[enable_regex].to_s != '0'
+ end
+ if regexp
+ settings[regex_field].to_s.split(delimiter).each do |value|
+ begin
+ Regexp.new(value)
+ rescue RegexpError => e
+ messages << [regex_field, "#{l('activerecord.errors.messages.not_a_regexp')} (#{e.message})"]
+ end
end
end
end
end
- end
messages
end