mirror of
https://github.com/moparisthebest/davmail
synced 2024-12-14 03:32:22 -05:00
IMAP: improve complex content-type handling in BODYSTRUCTURE
git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@775 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
parent
432e43ae14
commit
1a7f3ec005
@ -674,12 +674,18 @@ public class ImapConnection extends AbstractConnection {
|
|||||||
int charsetindex = contentType.indexOf("charset=");
|
int charsetindex = contentType.indexOf("charset=");
|
||||||
if (charsetindex >= 0) {
|
if (charsetindex >= 0) {
|
||||||
buffer.append(" (\"CHARSET\" ");
|
buffer.append(" (\"CHARSET\" ");
|
||||||
int charsetEndIndex = Math.max(contentType.indexOf(' '), contentType.length());
|
int charsetSemiColonIndex = contentType.indexOf(';', charsetindex);
|
||||||
|
int charsetEndIndex;
|
||||||
|
if (charsetSemiColonIndex > 0) {
|
||||||
|
charsetEndIndex = charsetSemiColonIndex;
|
||||||
|
} else {
|
||||||
|
charsetEndIndex = contentType.length();
|
||||||
|
}
|
||||||
String charSet = contentType.substring(charsetindex + "charset=".length(), charsetEndIndex);
|
String charSet = contentType.substring(charsetindex + "charset=".length(), charsetEndIndex);
|
||||||
if (!charSet.startsWith("\"")) {
|
if (!charSet.startsWith("\"")) {
|
||||||
buffer.append('"');
|
buffer.append('"');
|
||||||
}
|
}
|
||||||
buffer.append(charSet.toUpperCase());
|
buffer.append(charSet.trim().toUpperCase());
|
||||||
if (!charSet.endsWith("\"")) {
|
if (!charSet.endsWith("\"")) {
|
||||||
buffer.append('"');
|
buffer.append('"');
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user