Opened 15 years ago
Closed 14 years ago
#68 closed enhancement (fixed)
Strip attachments with certain file extensions
Reported by: | nidi | Owned by: | bas |
---|---|---|---|
Priority: | major | Milestone: | Release 1.1.0 |
Component: | email2trac | Version: | 0.3 |
Keywords: | Cc: | otto@… |
Description
Lots of people automatically add vcf cards or a pgp signature to their sent Emails. It'd be create if email2trac allowed to specify a list of attachment file extensions which will not be attached to tickets.
Attachments (0)
Change History (8)
comment:1 Changed 15 years ago by bas
- Status changed from new to assigned
comment:2 Changed 15 years ago by bas
Do you have patch that support this?
comment:3 Changed 14 years ago by otto@…
@@ -249,6 +249,11 @@ else: self.APPLEDOUBLE = 'warn' + if parameters.has_key('strip_attachments'): + self.STRIP_ATTACHMENTS = parameters['strip_attachments'] + else: + self.STRIP_ATTACHMENTS = '' + if parameters.has_key('python_egg_cache'): self.python_egg_cache = str(parameters['python_egg_cache']) os.environ['PYTHON_EGG_CACHE'] = self.python_egg_cache @@ -1110,6 +1115,16 @@ ## Check content type # + + + content_types = self.STRIP_ATTACHMENTS.split(","); + + if part.get_content_type() in content_types : + continue; + + + + if part.get_content_type() == 'application/mac-binhex40': # # Special handling for BinHex attachments. Options are drop (leave out with no warning), warn (and leave out), and keep
comment:4 Changed 14 years ago by bas
- Milestone set to Release 1.1.0
thanks for the patch. When i am back from holidays i will apply it.
comment:5 Changed 14 years ago by bas
- Cc otto@… added
I will rewrite some code so that we do not have a difference between the apple attachments and other platforms. Do you have an exampple of what you specifiy in email2trac.conf:
- strip_attachments : ....
comment:6 Changed 14 years ago by otto@…
Hi,
currently i have just set
strip_attachments: application/pgp-signature
but it should work with comma-seperated values also...
comment:7 Changed 14 years ago by bas
I used you suggestion a made some small adjustments. So the old code for apple attachments is integrated in this new setup. I renamed strip_attachments to:
- strip_content_types
It is still atring seperated by ','.
comment:8 Changed 14 years ago by bas
- Resolution set to fixed
- Status changed from assigned to closed
That we be a nice enhancement