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

Carddav: another urlcompname encoding fix

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1272 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2010-07-25 20:36:52 +00:00
parent d6984cff6f
commit 3056b143fa
3 changed files with 27 additions and 2 deletions

View File

@ -174,7 +174,7 @@ public class EwsExchangeSession extends ExchangeSession {
fieldUpdates.add(Field.createFieldUpdate("messageFlags", "0"));
}
}
fieldUpdates.add(Field.createFieldUpdate("urlcompname", StringUtil.encodeUrlcompname(messageName)));
fieldUpdates.add(Field.createFieldUpdate("urlcompname", messageName));
item.setFieldUpdates(fieldUpdates);
CreateItemMethod createItemMethod = new CreateItemMethod(MessageDisposition.SaveOnly, getFolderId(folderPath), item);
executeMethod(createItemMethod);

View File

@ -138,7 +138,11 @@ public class ExtendedFieldURI implements FieldURI {
buffer.append("</t:Values>");
} else {
buffer.append("<t:Value>");
buffer.append(StringUtil.xmlEncode(value));
if ("0x10f3".equals(propertyTag)) {
buffer.append(StringUtil.xmlEncode(StringUtil.encodeUrlcompname(value)));
} else {
buffer.append(StringUtil.xmlEncode(value));
}
buffer.append("</t:Value>");
}
buffer.append("</t:ExtendedProperty>");

View File

@ -441,4 +441,25 @@ public class TestExchangeSessionContact extends AbstractExchangeSessionTestCase
System.out.println(contact.getBody());
}
public void testSpecialCharacters() throws IOException {
VCardWriter vCardWriter = new VCardWriter();
vCardWriter.startCard();
vCardWriter.appendProperty("N", "sn", "givenName", "middlename", "personaltitle", "namesuffix");
vCardWriter.appendProperty("FN", "common name");
vCardWriter.endCard();
itemName = "test & accentué.vcf";
ExchangeSession.ItemResult result = session.createOrUpdateContact("testcontactfolder", itemName, vCardWriter.toString(), null, null);
assertEquals(201, result.status);
ExchangeSession.Contact contact = getCurrentContact();
assertEquals("common name", contact.get("cn"));
}
public void testdqdsq() throws IOException {
session.searchContacts("testcontactfolder", ExchangeSession.CONTACT_ATTRIBUTES, null);
}
}