manifoldcf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Furkan KAMACI (JIRA)" <>
Subject [jira] [Commented] (CONNECTORS-1409) Avoid Re-processing Emails
Date Fri, 14 Apr 2017 16:39:42 GMT


Furkan KAMACI commented on CONNECTORS-1409:

Currently, we run that code:

      final Multipart mp = (Multipart) msg.getContent();
      final int numAttachments = mp.getCount();
      for (int i = 0; i < numAttachments; i++) {
          activities.addDocumentReference(documentIdentifier + ":" + i);

However, e-mail is also a part of Multipart apart from its attachments. So, we process them
twice. We should decide whether a part is attachment or not. [Q: How do I find the attachments
in a message?|]

Attachments will usually, but not always, have a Content-Disposition of attachment. Attachments
will usually, but not always, have a file name.

So, a good approach to start with is to only consider messages with a top level multipart/mixed
content and then consider the parts after the first part to be attachments whether they say
so or not. 

I've tested it and e-mail is always at first part. Attachments comes after that. My solution
followed that approach. [] can you comment on this, whether do I miss
any cases? Does my understanding is correct about attachments always comes after first part?

> Avoid Re-processing Emails
> --------------------------
>                 Key: CONNECTORS-1409
>                 URL:
>             Project: ManifoldCF
>          Issue Type: Bug
>          Components: Email connector
>    Affects Versions: ManifoldCF 2.6
>            Reporter: Furkan KAMACI
>            Assignee: Furkan KAMACI
>             Fix For: ManifoldCF 2.7
>         Attachments: CONNECTORS-1409.patch
> Currently, we process e-mails twice which have attachments. We should avoid it.

This message was sent by Atlassian JIRA

View raw message