Skip to content

Commit

Permalink
Issue 6743: CM FileManager can't recognize file types if named with c…
Browse files Browse the repository at this point in the history
…apital suffix

Issue: http://code.google.com/p/cyanogenmod/issues/detail?id=6743

Added case compare to extension and mime/types.

Change-Id: I394472e03b5a92590088fdebbb75dd13ee4bade2
  • Loading branch information
jruesga committed Nov 27, 2012
1 parent 77fafd9 commit fa69140
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion res/raw/mime_types.properties
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# Mime type list
#
# Format:
# <extension> = <category> | <mime type> | <drawable>
# (extension) = (category) | (mime type) | (drawable)
#

# Binary
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ private static Mode getMode(String src) {
int cc = modes.length;
for (int i = 0; i < cc; i++) {
Mode mode = modes[i];
if (mode.mMode.mExtension.compareTo(extension) == 0) {
if (mode.mMode.mExtension.compareToIgnoreCase(extension) == 0) {
return mode;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -743,7 +743,7 @@ static void checkZipSecurityWarning(
// the system and is need a security alert that the user can confirm prior to
// make the extraction
String ext = FileHelper.getExtension(fso);
if (ConsoleBuilder.isPrivileged() && ext.compareTo("zip") == 0) { //$NON-NLS-1$
if (ConsoleBuilder.isPrivileged() && ext.compareToIgnoreCase("zip") == 0) { //$NON-NLS-1$
AlertDialog dialog = DialogHelper.createYesNoDialog(
ctx,
R.string.confirm_overwrite,
Expand Down
2 changes: 1 addition & 1 deletion src/com/cyanogenmod/filemanager/util/FileHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -827,7 +827,7 @@ public static boolean isSupportedUncompressedFile(FileSystemObject fso) {
if (ext != null) {
int cc = VALID.length;
for (int i = 0; i < cc; i++) {
if (VALID[i].compareTo(ext) == 0) {
if (VALID[i].compareToIgnoreCase(ext) == 0) {
return true;
}
}
Expand Down
10 changes: 5 additions & 5 deletions src/com/cyanogenmod/filemanager/util/MimeTypeHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ public static final String getIcon(Context context, FileSystemObject fso) {
//Get the extension and delivery
String ext = FileHelper.getExtension(fso);
if (ext != null) {
MimeTypeInfo mimeTypeInfo = sMimeTypes.get(ext);
MimeTypeInfo mimeTypeInfo = sMimeTypes.get(ext.toLowerCase());
if (mimeTypeInfo != null) {
// Create a new drawable
if (!TextUtils.isEmpty(mimeTypeInfo.mDrawable)) {
Expand Down Expand Up @@ -263,7 +263,7 @@ public static final String getMimeType(Context context, FileSystemObject fso) {
String ext = FileHelper.getExtension(fso);
if (ext != null) {
//Load from the database of mime types
MimeTypeInfo mimeTypeInfo = sMimeTypes.get(ext);
MimeTypeInfo mimeTypeInfo = sMimeTypes.get(ext.toLowerCase());
if (mimeTypeInfo != null) {
return mimeTypeInfo.mMimeType;
}
Expand Down Expand Up @@ -312,7 +312,7 @@ public static final String getMimeTypeDescription(Context context, FileSystemObj
String ext = FileHelper.getExtension(fso);
if (ext != null) {
//Load from the database of mime types
MimeTypeInfo mimeTypeInfo = sMimeTypes.get(ext);
MimeTypeInfo mimeTypeInfo = sMimeTypes.get(ext.toLowerCase());
if (mimeTypeInfo != null) {
return mimeTypeInfo.mMimeType;
}
Expand Down Expand Up @@ -347,7 +347,7 @@ public static final MimeTypeCategory getCategory(Context context, File file) {
String ext = FileHelper.getExtension(file.getName());
if (ext != null) {
//Load from the database of mime types
MimeTypeInfo mimeTypeInfo = sMimeTypes.get(ext);
MimeTypeInfo mimeTypeInfo = sMimeTypes.get(ext.toLowerCase());
if (mimeTypeInfo != null) {
return mimeTypeInfo.mCategory;
}
Expand Down Expand Up @@ -387,7 +387,7 @@ public static final MimeTypeCategory getCategory(Context context, FileSystemObje
String ext = FileHelper.getExtension(fso);
if (ext != null) {
//Load from the database of mime types
MimeTypeInfo mimeTypeInfo = sMimeTypes.get(ext);
MimeTypeInfo mimeTypeInfo = sMimeTypes.get(ext.toLowerCase());
if (mimeTypeInfo != null) {
return mimeTypeInfo.mCategory;
}
Expand Down

0 comments on commit fa69140

Please sign in to comment.