28 | | TBD |
| 28 | In `trac.ini`, add a new section `[attachment_filter]`, where: |
| 29 | * keys match the mime file type to exclude |
| 30 | * values gives a brief description that is shown to the user to explain why the file is rejected |
| 31 | |
| 32 | === Example === |
| 33 | |
| 34 | {{{ |
| 35 | #!ini |
| 36 | [attachment_filter] |
| 37 | application/vnd.ms-excel = Microsoft Excel documents should be attached as PDF files |
| 38 | application/vnd.ms-powerpoint = Microsoft PowerPoint documents should be attached as PDF files |
| 39 | application/msword = Microsoft Word documents should be attached as PDF files |
| 40 | image/bmp = Microsoft bitmap images should be attached as PNG images |
| 41 | }}} |
| 42 | |
| 43 | Yep, M$ is evil :-) |
| 44 | |
| 45 | === MIME type === |
| 46 | |
| 47 | To obtain the exact MIME type string: |
| 48 | 1. set up your Trac installation to show/dump INFO log message, |
| 49 | 1. attach a file of the (un)desired type |
| 50 | 1. look for the plugin trace that shows the file name and the MIME type: |
| 51 | {{{ |
| 52 | grep Filename .../log/trac.log |
| 53 | }}} |
| 54 | {{{ |
| 55 | 2011-05-16 15:49:26,299 Trac[filter] INFO: Filename stuff.doc, filetype application/msword |
| 56 | }}} |
| 57 | 1. add this new MIME type to the `[attachment_filter]` section |
| 58 | 1. restart your Trac engine |