Feature #19289 » 0001-Filter-email-attachments-based-on-content-ignore-fil.patch
| app/models/mail_handler.rb | ||
|---|---|---|
|
return false
|
||
|
end
|
||
|
end
|
||
|
# check if the attachment is match some ignored file
|
||
|
Dir::Tmpname.create('tmpattach') do |tmpfilename|
|
||
|
tmpfilenameextended = "#{tmpfilename}#{attachment.filename}"
|
||
|
File.open(tmpfilenameextended, 'wb') do |file|
|
||
|
file.write(attachment.body.decoded)
|
||
|
end
|
||
|
Dir['/home/redmine/redmine-ignored-attachments/*'].each do |ignoredf|
|
||
|
if FileUtils.cmp(ignoredf, tmpfilenameextended)
|
||
|
logger.info "MailHandler: ignoring attachment #{attachment.filename} matching #{ignoredf}"
|
||
|
FileUtils.rm(tmpfilenameextended)
|
||
|
return false
|
||
|
end
|
||
|
end
|
||
|
FileUtils.rm(tmpfilenameextended)
|
||
|
end
|
||
|
true
|
||
|
end
|
||
- « Previous
- 1
- 2
- 3
- Next »