am 6e7ea8cf: Fix problem with case of attachment name in EAS

Merge commit '6e7ea8cfe6fa3fe4380964df53c51ba7812b6372' into eclair-plus-aosp

* commit '6e7ea8cfe6fa3fe4380964df53c51ba7812b6372':
  Fix problem with case of attachment name in EAS
This commit is contained in:
Marc Blank 2009-09-05 22:18:51 -07:00 committed by Android Git Automerger
commit 9c84c2b2c6
2 changed files with 4 additions and 1 deletions

View File

@ -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.

View File

@ -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