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

This commit is contained in:
Simon MacDonald 2012-11-12 10:00:32 -05:00
parent 78b2835da4
commit 4fe73cf6ad

View File

@ -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));
}
/**