Skip to content

Commit

Permalink
Fix cid handling to use real outlook ContentId Attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
Marvin Rohrbach authored and bbottema committed Dec 18, 2019
1 parent 51fc131 commit 2e56b57
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ public class OutlookFileAttachment implements OutlookAttachment {
* Mime type of the attachment
*/
private String mimeTag;
/**
* CID of the attachment
*/
private String contentId;
/**
* The extension of the attachment (may not be set).
*/
Expand Down Expand Up @@ -58,6 +62,9 @@ public void setProperty(final OutlookMessageProperty msgProp) {
case "3703":
setExtension((String) value);
break;
case "3712":
setContentId((String) value);
break;
default:
// property to ignore, for full list see properties-list.txt
}
Expand Down Expand Up @@ -89,6 +96,21 @@ public String toString() {
return (longFilename != null) ? longFilename : filename;
}

/**
* Bean getter for {@link #contentId}.
*/
@SuppressWarnings("ElementOnlyUsedFromTestCode")
public String getContentId() {
return contentId;
}

/**
* Bean setter for {@link #contentId}.
*/
void setContentId(final String contentId) {
this.contentId = contentId;
}

/**
* Bean getter for {@link #extension}.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,9 +313,7 @@ public Map<String, OutlookFileAttachment> fetchCIDMap() {
for (final OutlookAttachment attachment : getOutlookAttachments()) {
if (attachment instanceof OutlookFileAttachment) {
final OutlookFileAttachment fileAttachment = (OutlookFileAttachment) attachment;
if (!tryAddCid(cidMap, html, fileAttachment, fileAttachment.getFilename())) {
tryAddCid(cidMap, html, fileAttachment, fileAttachment.getLongFilename());
}
tryAddCid(cidMap, html, fileAttachment, fileAttachment.getContentId());
}
}
}
Expand Down

0 comments on commit 2e56b57

Please sign in to comment.