From 6e7ea8cfe6fa3fe4380964df53c51ba7812b6372 Mon Sep 17 00:00:00 2001 From: Marc Blank Date: Sat, 5 Sep 2009 17:39:27 -0700 Subject: [PATCH] Fix problem with case of attachment name in EAS * Fixes #2102752 Change-Id: I9cc05a8fc02344f1f673c5ccb4e6aed0f9602350 --- src/com/android/exchange/adapter/EmailSyncAdapter.java | 2 +- tests/src/com/android/exchange/EasEmailSyncAdapterTests.java | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/com/android/exchange/adapter/EmailSyncAdapter.java b/src/com/android/exchange/adapter/EmailSyncAdapter.java index 9b3224848..6f607e170 100644 --- a/src/com/android/exchange/adapter/EmailSyncAdapter.java +++ b/src/com/android/exchange/adapter/EmailSyncAdapter.java @@ -295,7 +295,7 @@ public class EmailSyncAdapter extends AbstractSyncAdapter { int lastDot = fileName.lastIndexOf('.'); String extension = null; if ((lastDot > 0) && (lastDot < fileName.length() - 1)) { - extension = fileName.substring(lastDot + 1); + extension = fileName.substring(lastDot + 1).toLowerCase(); } if (extension == null) { // A reasonable default for now. diff --git a/tests/src/com/android/exchange/EasEmailSyncAdapterTests.java b/tests/src/com/android/exchange/EasEmailSyncAdapterTests.java index e6f7353d0..a3e7daeec 100644 --- a/tests/src/com/android/exchange/EasEmailSyncAdapterTests.java +++ b/tests/src/com/android/exchange/EasEmailSyncAdapterTests.java @@ -69,6 +69,9 @@ public class EasEmailSyncAdapterTests extends AndroidTestCase { // Test a few known types String mimeType = p.getMimeTypeFromFileName("foo.jpg"); assertEquals("image/jpeg", mimeType); + // Make sure this is case insensitive + mimeType = p.getMimeTypeFromFileName("foo.JPG"); + assertEquals("image/jpeg", mimeType); mimeType = p.getMimeTypeFromFileName("this_is_a_weird_filename.gif"); assertEquals("image/gif", mimeType); // Test an illegal file name ending with the extension prefix