support multiline name in attachment header

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@60 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2007-05-10 21:18:42 +00:00
parent 2658817680
commit e004248539
1 changed files with 13 additions and 0 deletions

View File

@ -609,6 +609,9 @@ public class ExchangeSession {
folder.folderUrl = inboxUrl;
} else if ("TRASH".equals(folderName)) {
folder.folderUrl = deleteditemsUrl;
// absolute folder path
} else if (folderName != null && folderName.startsWith("/")) {
folder.folderUrl = folderName;
} else {
folder.folderUrl = mailPath + folderName;
}
@ -1394,6 +1397,7 @@ public class ExchangeSession {
}
public void processHeaders(BufferedReader reader, OutputStream os) throws IOException {
// TODO implement a reliable header tokenizer
String line;
line = reader.readLine();
while (line != null && line.length() > 0) {
@ -1455,6 +1459,15 @@ public class ExchangeSession {
} else if ("name".equalsIgnoreCase(tokenName.toLowerCase())) {
name = token.substring(equalsIndex + 1);
if (name.startsWith("\"")) {
// if name is on more than one line, current line does not end with "
if (!name.endsWith("\"")) {
// append next lines
do {
line = reader.readLine();
writeLine(os, line);
name += line;
} while (!line.trim().endsWith("\""));
}
name = name.substring(1, name.lastIndexOf("\""));
}
// name can be mime encoded