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