mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-26 14:37:59 +01:00
allow null mime types
This commit is contained in:
parent
746ccc2d96
commit
1b587b3d10
2 changed files with 2 additions and 2 deletions
|
@ -62,7 +62,7 @@ class Utils {
|
|||
}
|
||||
}
|
||||
|
||||
fun getMimeType(url: String): String {
|
||||
fun getMimeType(url: String): String? {
|
||||
val extension = MimeTypeMap.getFileExtensionFromUrl(url)
|
||||
return if (extension != null) {
|
||||
MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension)
|
||||
|
|
|
@ -250,7 +250,7 @@ class MainActivity : SimpleActivity(), GetDirectoriesAsynctask.GetDirectoriesLis
|
|||
val path = resultData.data.path
|
||||
val uri = Uri.fromFile(File(path))
|
||||
if (mIsGetImageContentIntent || mIsGetVideoContentIntent || mIsGetAnyContentIntent) {
|
||||
val type = Utils.getMimeType(path)
|
||||
val type = Utils.getMimeType(path) ?: ""
|
||||
setDataAndTypeAndNormalize(uri, type)
|
||||
flags = Intent.FLAG_GRANT_READ_URI_PERMISSION or Intent.FLAG_GRANT_WRITE_URI_PERMISSION
|
||||
} else if (mIsPickImageIntent || mIsPickVideoIntent) {
|
||||
|
|
Loading…
Reference in a new issue