Skip to content

Commit fdd99a6

Browse files
iJimmyWeiJimmy
authored and
Jimmy
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 dcbde6f commit fdd99a6

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

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

+2-4
Original file line numberDiff line numberDiff line change
@@ -766,11 +766,9 @@ public void onReceive(Context context, Intent intent) {
766766
return;
767767
}
768768
String contentUri = c.getString(c.getColumnIndex(DownloadManager.COLUMN_LOCAL_URI));
769-
if ( contentUri != null &&
770-
options.addAndroidDownloads.hasKey("mime") &&
771-
options.addAndroidDownloads.getString("mime").contains("image")) {
769+
if ( contentUri != null ) {
772770
Uri uri = Uri.parse(contentUri);
773-
Cursor cursor = appCtx.getContentResolver().query(uri, new String[]{android.provider.MediaStore.Images.ImageColumns.DATA}, null, null, null);
771+
Cursor cursor = appCtx.getContentResolver().query(uri, new String[]{android.provider.MediaStore.Files.FileColumns.DATA}, null, null, null);
774772
// use default destination of DownloadManager
775773
if (cursor != null) {
776774
cursor.moveToFirst();

0 commit comments

Comments
 (0)