Skip to content

Commit 73bfb9c

Browse files
committed
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
1 parent 1933faf commit 73bfb9c

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

android/src/main/java/com/RNFetchBlob/RNFetchBlobReq.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -762,11 +762,9 @@ public void onReceive(Context context, Intent intent) {
762762
return;
763763
}
764764
String contentUri = c.getString(c.getColumnIndex(DownloadManager.COLUMN_LOCAL_URI));
765-
if ( contentUri != null &&
766-
options.addAndroidDownloads.hasKey("mime") &&
767-
options.addAndroidDownloads.getString("mime").contains("image")) {
765+
if ( contentUri != null ) {
768766
Uri uri = Uri.parse(contentUri);
769-
Cursor cursor = appCtx.getContentResolver().query(uri, new String[]{android.provider.MediaStore.Images.ImageColumns.DATA}, null, null, null);
767+
Cursor cursor = appCtx.getContentResolver().query(uri, new String[]{android.provider.MediaStore.Files.FileColumns.DATA}, null, null, null);
770768
// use default destination of DownloadManager
771769
if (cursor != null) {
772770
cursor.moveToFirst();

0 commit comments

Comments
 (0)