Skip to content

Commit

Permalink
Fixed issue selecting images from download folder
Browse files Browse the repository at this point in the history
Fixed uri to file path conversion

#86 #123
  • Loading branch information
Dhaval2404 committed Dec 21, 2020
1 parent 824cf83 commit d3a7f1a
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,16 @@ object FileUriUtils {
} else if (isDownloadsDocument(uri)) {
val fileName = getFilePath(context, uri)
if (fileName != null) {
return Environment.getExternalStorageDirectory().toString() + "/Download/" + fileName
val path = Environment.getExternalStorageDirectory().toString() + "/Download/" + fileName
if (File(path).exists()) {
return path
}
}

val id = DocumentsContract.getDocumentId(uri)
var id = DocumentsContract.getDocumentId(uri)
if (id.contains(":")) {
id = id.split(":")[1]
}
val contentUri = ContentUris.withAppendedId(
Uri.parse("content://downloads/public_downloads"), java.lang.Long.valueOf(id)
)
Expand Down

0 comments on commit d3a7f1a

Please sign in to comment.