Yet another MIME header fix (multiline), need a dedicated parser

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@72 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2007-08-13 08:43:52 +00:00
parent a91a0e159d
commit 4bad3f5577
1 changed files with 11 additions and 2 deletions

View File

@ -931,7 +931,7 @@ public class ExchangeSession {
if (attachment == null && partHeader.fileName != null) {
attachment = attachmentsMap.get(partHeader.fileName);
}
attachmentIndex++;
if (attachment == null) {
// only warn, could happen depending on IIS config
@ -1531,7 +1531,16 @@ public class ExchangeSession {
// TODO : recode with header parser
int filenameIndex = line.indexOf("filename=\"");
if (filenameIndex >= 0) {
fileName = line.substring(filenameIndex + 10, line.lastIndexOf("\""));
// handle multiline header
if (line.endsWith("\"")) {
fileName = line.substring(filenameIndex + 10, line.lastIndexOf("\""));
} else {
fileName = line.substring(filenameIndex + 10);
// read next file name line
line = fixRenamedAttachment(reader.readLine(), currentAttachmentName);
writeLine(os, line);
fileName += line.substring(1, line.lastIndexOf("\""));
}
}
}
line = fixRenamedAttachment(reader.readLine(), currentAttachmentName);