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@…


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

That we be a nice enhancement

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 @@
 			self.APPLEDOUBLE = 'warn'
+		if parameters.has_key('strip_attachments'):
+			self.STRIP_ATTACHMENTS = parameters['strip_attachments']
+		else:
 		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@…


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

(In [294])

  • added new configuration parameter, strip_content_types thanks to Otto. eg:

strip_content_types: application/pgp-signature, application/mac-binhex40

Will skip pgp signature attachments and apple binhex40 attachments, closes #68

Add Comment

Modify Ticket

Change Properties
as closed The owner will remain bas.
The resolution will be deleted. Next status will be 'reopened'.

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.