From 73bfb9c8469e89a818de25c899c3c9515b1f6657 Mon Sep 17 00:00:00 2001 From: Jimmy Date: Mon, 6 Jul 2020 10:18:21 +0100 Subject: [PATCH] Fix an issue with non "image" mimeTypes downloading on android * The promise fails even though the download goes through due to this explicit check not setting filePath --- android/src/main/java/com/RNFetchBlob/RNFetchBlobReq.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/android/src/main/java/com/RNFetchBlob/RNFetchBlobReq.java b/android/src/main/java/com/RNFetchBlob/RNFetchBlobReq.java index d2f2252a2..8abd27c05 100644 --- a/android/src/main/java/com/RNFetchBlob/RNFetchBlobReq.java +++ b/android/src/main/java/com/RNFetchBlob/RNFetchBlobReq.java @@ -762,11 +762,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();