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

Carddav: fix case insensitive param values

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1201 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2010-07-19 09:56:49 +00:00
parent 2c63a6b72a
commit 2d775713ec
3 changed files with 22 additions and 7 deletions

View File

@ -2683,13 +2683,13 @@ public abstract class ExchangeSession {
} else if ("NICKNAME".equals(property.getKey())) {
properties.put("nickname", property.getValue());
} else if ("TEL".equals(property.getKey())) {
if (property.hasParam("TYPE", "cell") || property.hasParam("X-GROUP", "CELL")) {
if (property.hasParam("TYPE", "cell") || property.hasParam("X-GROUP", "cell")) {
properties.put("mobile", property.getValue());
}
if (property.hasParam("TYPE", "work") || property.hasParam("X-GROUP", "WORK")) {
if (property.hasParam("TYPE", "work") || property.hasParam("X-GROUP", "work")) {
properties.put("telephoneNumber", property.getValue());
}
if (property.hasParam("TYPE", "home") || property.hasParam("X-GROUP", "HOME")) {
if (property.hasParam("TYPE", "home") || property.hasParam("X-GROUP", "home")) {
properties.put("homePhone", property.getValue());
}
if (property.hasParam("TYPE", "fax")) {

View File

@ -175,28 +175,28 @@ public class VCardReader extends ICSBufferedReader {
startIndex = i + 1;
} else if (currentChar == ':') {
if (startIndex < i) {
paramValues.add(line.substring(startIndex, i));
paramValues.add(line.substring(startIndex, i).toLowerCase());
}
property.addParam(paramName, paramValues);
state = State.VALUE;
startIndex = i + 1;
} else if (currentChar == ';') {
if (startIndex < i) {
paramValues.add(line.substring(startIndex, i));
paramValues.add(line.substring(startIndex, i).toLowerCase());
}
property.addParam(paramName, paramValues);
state = State.PARAM_NAME;
startIndex = i + 1;
} else if (currentChar == ',') {
if (startIndex < i) {
paramValues.add(line.substring(startIndex, i));
paramValues.add(line.substring(startIndex, i).toLowerCase());
}
startIndex = i + 1;
}
} else if (state == State.QUOTED_PARAM_VALUE) {
if (currentChar == '"') {
state = State.PARAM_VALUE;
paramValues.add(line.substring(startIndex, i));
paramValues.add(line.substring(startIndex, i).toLowerCase());
startIndex = i + 1;
}
} else if (state == State.VALUE) {

View File

@ -274,7 +274,22 @@ public class TestExchangeSessionContact extends AbstractExchangeSessionTestCase
assertNull(contact.get("haspicture"));
assertNull(session.getContactPhoto(contact));
}
public void testUpperCaseParamName() throws IOException {
ExchangeSession.Contact contact = (ExchangeSession.Contact) session.getItem("testcontactfolder", itemName);
VCardWriter vCardWriter = new VCardWriter();
vCardWriter.startCard();
vCardWriter.appendProperty("TEL;TYPE=CELL", "mobile");
vCardWriter.endCard();
ExchangeSession.ItemResult result = session.createOrUpdateContact("testcontactfolder", itemName, vCardWriter.toString(), contact.etag, null);
assertEquals(200, result.status);
contact = (ExchangeSession.Contact) session.getItem("testcontactfolder", itemName);
assertEquals("mobile", contact.get("mobile"));
}
}