mirror of
https://github.com/apache/cordova-android.git
synced 2025-01-31 17:32:51 +08:00
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:
parent
78b2835da4
commit
4fe73cf6ad
@ -984,8 +984,11 @@ public class FileUtils extends CordovaPlugin {
|
|||||||
* @return a mime type
|
* @return a mime type
|
||||||
*/
|
*/
|
||||||
public static String getMimeType(String filename) {
|
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();
|
MimeTypeMap map = MimeTypeMap.getSingleton();
|
||||||
return map.getMimeTypeFromExtension(MimeTypeMap.getFileExtensionFromUrl(filename));
|
return map.getMimeTypeFromExtension(MimeTypeMap.getFileExtensionFromUrl(url));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user