Skip to content

Commit

Permalink
CB-1835: Camera.getPicture gives error when get a picture from photo …
Browse files Browse the repository at this point in the history
…library with spaces in its name on Android
  • Loading branch information
macdonst committed Nov 12, 2012
1 parent 78b2835 commit 4fe73cf
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion framework/src/org/apache/cordova/FileUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -984,8 +984,11 @@ public String readAsDataURL(String filename) throws FileNotFoundException, IOExc
* @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));
}

/**
Expand Down

0 comments on commit 4fe73cf

Please sign in to comment.