try to get inline attachment by content id when name not provided
git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@81 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
parent
dfd6cc12ee
commit
1dfae49a2d
|
@ -92,6 +92,7 @@ public class ExchangeSession {
|
||||||
public static final String CONTENT_TYPE_HEADER = "content-type: ";
|
public static final String CONTENT_TYPE_HEADER = "content-type: ";
|
||||||
public static final String CONTENT_TRANSFER_ENCODING_HEADER = "content-transfer-encoding: ";
|
public static final String CONTENT_TRANSFER_ENCODING_HEADER = "content-transfer-encoding: ";
|
||||||
public static final String CONTENT_DISPOSITION_HEADER = "content-disposition: ";
|
public static final String CONTENT_DISPOSITION_HEADER = "content-disposition: ";
|
||||||
|
public static final String CONTENT_ID_HEADER = "content-id: ";
|
||||||
|
|
||||||
private static final int DEFAULT_KEEP_DELAY = 30;
|
private static final int DEFAULT_KEEP_DELAY = 30;
|
||||||
|
|
||||||
|
@ -921,6 +922,14 @@ public class ExchangeSession {
|
||||||
if (attachment == null && (partHeader.name == null || "winmail.dat".equals(partHeader.name))) {
|
if (attachment == null && (partHeader.name == null || "winmail.dat".equals(partHeader.name))) {
|
||||||
attachment = attachmentsMap.get(String.valueOf(attachmentIndex));
|
attachment = attachmentsMap.get(String.valueOf(attachmentIndex));
|
||||||
}
|
}
|
||||||
|
// try to get attachment by content id
|
||||||
|
if (attachment == null && partHeader.contentId != null) {
|
||||||
|
for (Attachment entry : attachmentsMap.values()) {
|
||||||
|
if (partHeader.contentId.equals(entry.contentid)) {
|
||||||
|
attachment = entry;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
// try to get by index if attachment renamed to application
|
// try to get by index if attachment renamed to application
|
||||||
if (attachment == null && partHeader.name != null) {
|
if (attachment == null && partHeader.name != null) {
|
||||||
if (currentAttachment != null && currentAttachment.name.startsWith("application")) {
|
if (currentAttachment != null && currentAttachment.name.startsWith("application")) {
|
||||||
|
@ -1417,6 +1426,7 @@ public class ExchangeSession {
|
||||||
public String contentTransferEncoding = null;
|
public String contentTransferEncoding = null;
|
||||||
public String boundary = null;
|
public String boundary = null;
|
||||||
public String name = null;
|
public String name = null;
|
||||||
|
public String contentId = null;
|
||||||
/**
|
/**
|
||||||
* filename in Content-Disposition header
|
* filename in Content-Disposition header
|
||||||
*/
|
*/
|
||||||
|
@ -1556,6 +1566,14 @@ public class ExchangeSession {
|
||||||
fileName += line.substring(1, line.lastIndexOf("\""));
|
fileName += line.substring(1, line.lastIndexOf("\""));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (lineToCompare.startsWith(CONTENT_ID_HEADER)) {
|
||||||
|
contentId = line.substring(CONTENT_ID_HEADER.length()).trim();
|
||||||
|
if (contentId.startsWith("<")) {
|
||||||
|
contentId = contentId.substring(1);
|
||||||
|
}
|
||||||
|
if (contentId.endsWith(">")) {
|
||||||
|
contentId = contentId.substring(0, contentId.length()-1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
line = fixRenamedAttachment(reader.readLine(), currentAttachmentName);
|
line = fixRenamedAttachment(reader.readLine(), currentAttachmentName);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue