0002-Whitespace-only.patch

Jan from Planio www.plan.io, 2017-09-18 19:41

Download (2.38 KB)

View differences:

app/models/mail_handler.rb
312 312
      if Setting.mail_handler_enable_regex_excluded_filenames?
313 313
        regexp = %r{\A#{pattern}\z}i
314 314
      else
315
      regexp = %r{\A#{Regexp.escape(pattern).gsub("\\*", ".*")}\z}i
315
        regexp = %r{\A#{Regexp.escape(pattern).gsub("\\*", ".*")}\z}i
316 316
      end
317 317
      if attachment.filename.to_s =~ regexp
318 318
        logger.info "MailHandler: ignoring attachment #{attachment.filename} matching #{pattern}"
app/models/setting.rb
147 147
     [:mail_handler_enable_regex_excluded_filenames, :mail_handler_excluded_filenames, /\s*,\s*/]
148 148
    ].each do |enable_regex, regex_field, delimiter|
149 149

  
150
    if settings.key?(regex_field) || settings.key?(enable_regex)
151
      regexp = Setting.send("#{enable_regex}?")
152
      if settings.key?(enable_regex)
153
        regexp = settings[enable_regex].to_s != '0'
154
      end
155
      if regexp
156
        settings[regex_field].to_s.split(delimiter).each do |value|
157
          begin
158
            Regexp.new(value)
159
          rescue RegexpError => e
160
            messages << [regex_field, "#{l('activerecord.errors.messages.not_a_regexp')} (#{e.message})"]
150
      if settings.key?(regex_field) || settings.key?(enable_regex)
151
        regexp = Setting.send("#{enable_regex}?")
152
        if settings.key?(enable_regex)
153
          regexp = settings[enable_regex].to_s != '0'
154
        end
155
        if regexp
156
          settings[regex_field].to_s.split(delimiter).each do |value|
157
            begin
158
              Regexp.new(value)
159
            rescue RegexpError => e
160
              messages << [regex_field, "#{l('activerecord.errors.messages.not_a_regexp')} (#{e.message})"]
161
            end
161 162
          end
162 163
        end
163 164
      end
164 165
    end
165
    end
166 166

  
167 167
    messages
168 168
  end
169
-