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

Carddav: fix semicolon encoding in compound value

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1227 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2010-07-20 13:51:58 +00:00
parent 866ac09a0b
commit 70b368a66b
2 changed files with 16 additions and 1 deletions

View File

@ -215,10 +215,14 @@ public class VCardReader extends ICSBufferedReader {
startIndex = i + 1;
}
} else if (state == State.VALUE) {
if (currentChar == ';') {
if (currentChar == '\\') {
state = State.BACKSLASH;
} else if (currentChar == ';') {
property.addValue(line.substring(startIndex, i));
startIndex = i + 1;
}
} else if (state == State.BACKSLASH) {
state = State.VALUE;
}
}
property.addValue(line.substring(startIndex));

View File

@ -361,4 +361,15 @@ public class TestExchangeSessionContact extends AbstractExchangeSessionTestCase
assertEquals("rouge,vert", contact.get("keywords"));
}
public void testSemiColonInCompoundValue() throws IOException {
ExchangeSession.Contact contact = getCurrentContact();
String itemBody = "BEGIN:VCARD\n" +
"VERSION:3.0\n" +
"item1.ADR;type=WORK;type=pref:;;line1\\nline 2 \\; with semicolon;;;;\n" +
"END:VCARD";
ExchangeSession.ItemResult result = session.createOrUpdateContact("testcontactfolder", itemName, itemBody, contact.etag, null);
assertEquals(200, result.status);
}
}