From 28d9270ac51380f13ae1355e423c0f7a4b0d251f Mon Sep 17 00:00:00 2001 From: vitriolix Date: Mon, 25 May 2015 20:37:09 -0700 Subject: [PATCH] Update FileUtils.java Fixes issue where getMimeType is always returning null on devices such as the Galaxy Camera that use .MP4 instead of .mp4 for file extensions --- .../src/com/ipaulpro/afilechooser/utils/FileUtils.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/aFileChooser/src/com/ipaulpro/afilechooser/utils/FileUtils.java b/aFileChooser/src/com/ipaulpro/afilechooser/utils/FileUtils.java index 25c8008..7d0aa32 100644 --- a/aFileChooser/src/com/ipaulpro/afilechooser/utils/FileUtils.java +++ b/aFileChooser/src/com/ipaulpro/afilechooser/utils/FileUtils.java @@ -37,6 +37,7 @@ import java.io.FileFilter; import java.text.DecimalFormat; import java.util.Comparator; +import java.util.Locale; /** * @version 2009-07-03 @@ -144,7 +145,9 @@ public static File getPathWithoutFilename(File file) { public static String getMimeType(File file) { String extension = getExtension(file.getName()); - + // Convert the extension to lower case to ensure compatibility with MimeTypeMap on devices + // that use e.g. .MP4 for extension + extension = extension.toLowerCase(Locale.getDefault()); if (extension.length() > 0) return MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension.substring(1));