JIRA mail handler does not handle all attachments correctly

XMLWordPrintable

    • 3.13

      REF: JSP-37399

      When the attached e-mail message is used to create an issue we expect the WAV file attached in the e-mail to also be attached to the case. In reality, JIRA only attaches the GIF attached to the e-mail.

      Having looked at the code JIRA is actually looking at the WAV attachment but decides not to attach it. The logic for the whole thing is:

      if (part.content-type = "message/rfc822")
      {
      	if (jira is configured to attach mail messages)
      	{
      		if (part is not a reply to the current message)
      		{
      			if (part is not empty)
      			{
      				attach it.
      			}
      		}
      	}
      } 
      else if (part.Content-Disposition = "attachment")
      {
      	if (part is not empty and not S/MIME signature)
      	{
      		attach it.
      	}
      } 
      else if ((part.Content-Disposition = "inline" AND part has filename in disposition) OR (part has content id and part is base64 encoded))
      {
      	if (part is not empty and not S/MIME signature)
      	{
      		attach it.
      	}
      }
      else if (part.content-type = "text/plain")
      {
      	if (part is not empty and part.Content-Disposition = "attachment")
      	{
      		attach it
      	}
      }
      else if (part.content-type = "text/html")
      {
      	if (part is not empty and part.Content-Disposition = "attachment")
      	{
      		attach it
      	}
      }
      else if (part.content-type = "multipart/related")
      {
      	if (not empty)
      	{
      		attach it.
      	}
      }
      

      This logic is broken and quite strange. For example, the last condition can never be met since this logic is never called for multipart sections of a message. I also can't see how the "text/plain" or "text/html" conditions are relevant since they never attach parts where part.Content-Disposition != "attachment".

      Thunderbird seems to see the file as an attachment. Maybe what we need to do is work out what it is doing internally, and then copy the logic?

            Assignee:
            Eric Dalgliesh
            Reporter:
            bain
            Votes:
            6 Vote for this issue
            Watchers:
            12 Start watching this issue

              Created:
              Updated:
              Resolved: