Skip to content

Commit

Permalink
Fix an issue with non "image" mime types downloading with android dow…
Browse files Browse the repository at this point in the history
…nload manager joltup#623
  • Loading branch information
Dmitriy Grachev committed Jun 3, 2021
1 parent dcbde6f commit 330d79a
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions android/src/main/java/com/RNFetchBlob/RNFetchBlobReq.java
Original file line number Diff line number Diff line change
Expand Up @@ -766,11 +766,9 @@ public void onReceive(Context context, Intent intent) {
return;
}
String contentUri = c.getString(c.getColumnIndex(DownloadManager.COLUMN_LOCAL_URI));
if ( contentUri != null &&
options.addAndroidDownloads.hasKey("mime") &&
options.addAndroidDownloads.getString("mime").contains("image")) {
if ( contentUri != null ) {
Uri uri = Uri.parse(contentUri);
Cursor cursor = appCtx.getContentResolver().query(uri, new String[]{android.provider.MediaStore.Images.ImageColumns.DATA}, null, null, null);
Cursor cursor = appCtx.getContentResolver().query(uri, new String[]{android.provider.MediaStore.Files.FileColumns.DATA}, null, null, null);
// use default destination of DownloadManager
if (cursor != null) {
cursor.moveToFirst();
Expand Down

0 comments on commit 330d79a

Please sign in to comment.