1
0
mirror of https://github.com/moparisthebest/davmail synced 2024-12-14 19:52:21 -05:00

IMAP: fix 3353862, long file names encoding in BODYSTRUCTURE

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1812 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2011-10-03 22:18:41 +00:00
parent b1edabf45f
commit c94e881359

View File

@ -1052,7 +1052,7 @@ public class ImapConnection extends AbstractConnection {
} }
protected void appendBodyStructure(StringBuilder buffer, MimePart bodyPart) throws IOException, MessagingException { protected void appendBodyStructure(StringBuilder buffer, MimePart bodyPart) throws IOException, MessagingException {
String contentType = bodyPart.getContentType(); String contentType = MimeUtility.unfold(bodyPart.getContentType());
int slashIndex = contentType.indexOf('/'); int slashIndex = contentType.indexOf('/');
if (slashIndex < 0) { if (slashIndex < 0) {
throw new DavMailException("EXCEPTION_INVALID_CONTENT_TYPE", contentType); throw new DavMailException("EXCEPTION_INVALID_CONTENT_TYPE", contentType);
@ -1102,7 +1102,7 @@ public class ImapConnection extends AbstractConnection {
} else { } else {
nameEndIndex = contentType.length(); nameEndIndex = contentType.length();
} }
String name = contentType.substring(nameindex + "name=".length(), nameEndIndex); String name = contentType.substring(nameindex + "name=".length(), nameEndIndex).trim();
if (!name.startsWith("\"")) { if (!name.startsWith("\"")) {
buffer.append('"'); buffer.append('"');
} }