Updated Branches:
  refs/heads/master dc459c84a -> 4fe73cf6a

CB-1835: Camera.getPicture gives error when get a picture from photo library 
with spaces in its name on Android


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/commit/4fe73cf6
Tree: 
http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/tree/4fe73cf6
Diff: 
http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/diff/4fe73cf6

Branch: refs/heads/master
Commit: 4fe73cf6ad5ebeb85f0c5868c12af25b66b6b2a0
Parents: 78b2835
Author: Simon MacDonald <[email protected]>
Authored: Mon Nov 12 10:00:32 2012 -0500
Committer: Simon MacDonald <[email protected]>
Committed: Mon Nov 12 10:00:32 2012 -0500

----------------------------------------------------------------------
 framework/src/org/apache/cordova/FileUtils.java |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/4fe73cf6/framework/src/org/apache/cordova/FileUtils.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/FileUtils.java 
b/framework/src/org/apache/cordova/FileUtils.java
index 46f2e9c..c2f90b6 100755
--- a/framework/src/org/apache/cordova/FileUtils.java
+++ b/framework/src/org/apache/cordova/FileUtils.java
@@ -984,8 +984,11 @@ public class FileUtils extends CordovaPlugin {
      * @return a mime type
      */
     public static String getMimeType(String filename) {
+        // Stupid bug in getFileExtensionFromUrl when the file name has a space
+        // So we need to replace the space with a url encoded %20
+        String url = filename.replace(" ", "%20");
         MimeTypeMap map = MimeTypeMap.getSingleton();
-        return 
map.getMimeTypeFromExtension(MimeTypeMap.getFileExtensionFromUrl(filename));
+        return 
map.getMimeTypeFromExtension(MimeTypeMap.getFileExtensionFromUrl(url));
     }
 
     /**

Reply via email to