You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@manifoldcf.apache.org by "Furkan KAMACI (JIRA)" <ji...@apache.org> on 2017/04/14 16:39:42 UTC

[jira] [Commented] (CONNECTORS-1409) Avoid Re-processing Emails

    [ https://issues.apache.org/jira/browse/CONNECTORS-1409?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15969232#comment-15969232 ] 

Furkan KAMACI commented on CONNECTORS-1409:
-------------------------------------------

Currently, we run that code:

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

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?|http://www.oracle.com/technetwork/java/faq-135477.html#attachments]

{quote}
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. 
{quote}

I've tested it and e-mail is always at first part. Attachments comes after that. My solution followed that approach. [~kwright@metacarta.com] 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: https://issues.apache.org/jira/browse/CONNECTORS-1409
>             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
(v6.3.15#6346)