wiki:AttachFilterPlugin

Reject attachments

Description

This is a simple plugin to reject attachments, using file-extension based rules. It offers guidance to the user as to how alternatives for uploading the file can be performed.

Bugs/Feature Requests

Existing bugs and feature requests for AttachFilterPlugin are here.

If you have any issues, create a new ticket.

defect

1 / 1

enhancement

0 / 1

task

1 / 1

Download

Download the zipped source from here.

Source

You can check out AttachFilterPlugin from here using Subversion, or browse the source with Trac.

Installation

General instructions on installing Trac plugins can be found on the TracPlugins page.

Configuration

In your trac.ini file, add a new section [attachment_filter], where:

  • keys match the mime file type to exclude
  • values gives a brief description that is shown to the user to explain why the file is rejected

Example

[attachment_filter]
application/vnd.ms-excel = Microsoft Excel documents should be attached as PDF files
application/vnd.ms-powerpoint = Microsoft PowerPoint documents should be attached as PDF files
application/msword = Microsoft Word documents should be attached as PDF files
image/bmp = Microsoft bitmap images should be attached as PNG images

MIME type

To obtain the exact MIME type string:

  1. Set up your Trac installation to show/dump INFO log message.
  2. Attach a file of the (un)desired type.
  3. Look for the plugin trace that shows the file name and the MIME type:
    $ grep Filename .../log/trac.log
    2011-05-16 15:49:26,299 Trac[filter] INFO: Filename stuff.doc, filetype application/msword
    
  4. Add this new MIME type to the [attachment_filter] section.
  5. Restart your Trac engine.

Recent Changes

13141 by rjollos on 2013-05-15 09:42:56
Removed empty directory.
10202 by eblot on 2011-05-16 15:53:07
Closes #8806. Import initial version of the plugin
10201 by eblot on 2011-05-16 15:24:08
New hack AttachFilterPlugin, created by eblot
(more)

Author/Contributors

Author: eblot
Maintainer: Ryan J Ollos
Contributors:

Last modified 9 years ago Last modified on Nov 12, 2015, 4:53:03 PM