reimplement index based attachment retrieval

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@46 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2007-04-23 22:13:41 +00:00
parent 8051c57537
commit 3582bac793
1 changed files with 8 additions and 1 deletions

View File

@ -822,6 +822,13 @@ public class ExchangeSession {
if (attachment == null && partHeader.name == null) { if (attachment == null && partHeader.name == null) {
attachment = attachmentsMap.get(String.valueOf(attachmentIndex)); attachment = attachmentsMap.get(String.valueOf(attachmentIndex));
} }
// try to get by index if attachment renamed to application
if (attachment == null && partHeader.name != null) {
Attachment currentAttachment = attachmentsMap.get(String.valueOf(attachmentIndex));
if (currentAttachment.name.startsWith("application")) {
attachment = currentAttachment;
}
}
attachmentIndex++; attachmentIndex++;
if (attachment == null) { if (attachment == null) {
// only warn, could happen depending on IIS config // only warn, could happen depending on IIS config
@ -1101,7 +1108,7 @@ public class ExchangeSession {
getMethod.releaseConnection(); getMethod.releaseConnection();
attachmentsMap = new HashMap<String, Attachment>(); attachmentsMap = new HashMap<String, Attachment>();
int attachmentIndex = 2; int attachmentIndex = 1;
// list file attachments identified explicitly // list file attachments identified explicitly
List<Attribute> list = xmlDocument.getNodes("//table[@id='idAttachmentWell']//a/@href"); List<Attribute> list = xmlDocument.getNodes("//table[@id='idAttachmentWell']//a/@href");
for (Attribute element : list) { for (Attribute element : list) {