1
0
mirror of https://github.com/moparisthebest/davmail synced 2024-12-13 11:12:22 -05:00

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

View File

@ -931,7 +931,7 @@ public class ExchangeSession {
if (attachment == null && partHeader.fileName != null) { if (attachment == null && partHeader.fileName != null) {
attachment = attachmentsMap.get(partHeader.fileName); attachment = attachmentsMap.get(partHeader.fileName);
} }
attachmentIndex++; attachmentIndex++;
if (attachment == null) { if (attachment == null) {
// only warn, could happen depending on IIS config // only warn, could happen depending on IIS config
@ -1531,7 +1531,16 @@ public class ExchangeSession {
// TODO : recode with header parser // TODO : recode with header parser
int filenameIndex = line.indexOf("filename=\""); int filenameIndex = line.indexOf("filename=\"");
if (filenameIndex >= 0) { 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); line = fixRenamedAttachment(reader.readLine(), currentAttachmentName);