|Version 2 (modified by 6 years ago) (diff),|
A very simple plugin to reject attachments, with file-extension based rules.
If you have any issues, create a new ticket.
Download the zipped source from [download:attachfilterplugin here].
trac.ini, add a new section
- 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
[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
Yep, M$ is evil :-)
To obtain the exact MIME type string:
- set up your Trac installation to show/dump INFO log message,
- attach a file of the (un)desired type
- 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
- add this new MIME type to the
- restart your Trac engine