Fix SmartReply/SmartForward in EAS 2.5

* We inadvertently broke this with a recent update that uses Uri
  encoding for ItemId and CollectionId in SmartForward/Reply commands.
  We need to allow colon (:) however for EAS 2.5; otherwise, sends
  fail with HTTP 500
* Update unit test

Bug: 2821684
Change-Id: Ia6bdd2169513d1c13a8174dd599477a35df950f2
This commit is contained in:
Marc Blank 2010-07-06 12:54:21 -07:00
parent 6e47262274
commit 5b02ecf87c
2 changed files with 6 additions and 6 deletions

View File

@ -73,8 +73,8 @@ public class EasOutboxService extends EasSyncService {
}
/*package*/ String generateSmartSendCmd(boolean reply, String itemId, String collectionId) {
return (reply ? "SmartReply" : "SmartForward") + "&ItemId=" + Uri.encode(itemId) +
"&CollectionId=" + Uri.encode(collectionId);
return (reply ? "SmartReply" : "SmartForward") + "&ItemId=" + Uri.encode(itemId, ":") +
"&CollectionId=" + Uri.encode(collectionId, ":");
}
/**

View File

@ -38,11 +38,11 @@ public class EasOutboxServiceTests extends AndroidTestCase {
public void testGenerateSmartSendCmd() {
EasOutboxService svc = new EasOutboxService(mMockContext, new Mailbox());
// Test encoding of collection id
// Test encoding of collection id; colon should be preserved
String cmd = svc.generateSmartSendCmd(true, "1339085683659694034", "Mail:^f");
assertEquals("SmartReply&ItemId=1339085683659694034&CollectionId=Mail%3A%5Ef", cmd);
assertEquals("SmartReply&ItemId=1339085683659694034&CollectionId=Mail:%5Ef", cmd);
// Test encoding of item id
cmd = svc.generateSmartSendCmd(false, "14:3", "6");
assertEquals("SmartForward&ItemId=14%3A3&CollectionId=6", cmd);
cmd = svc.generateSmartSendCmd(false, "14:&3", "6");
assertEquals("SmartForward&ItemId=14:%263&CollectionId=6", cmd);
}
}