react-native-blob-util
react-native-blob-util copied to clipboard
Get two files when using Download Manager in Android 11 and one of them comes empty
Expected Behavior
Download just one file when using Download Manager in Android 11
My Code
const dirs = RNFetchBlob.fs.dirs;
let addAndroidDownloads: AddAndroidDownloads = {
title: fileName,
description: 'Download success',
mediaScannable: true,
notification: true,
useDownloadManager: true,
mime: metadata.mimeType,
path: `${RNFS.DownloadDirectoryPath}/${fileName}`,
};
const res = await RNFetchBlob.config({
fileCache: true,
path: `${dirs.CacheDir}/${fileName}`,
addAndroidDownloads,
}).fetch('GET', url);
Current Behavior
This create 2 files, one is correct, but the other comes with 0 bytes
The notification is working fine:
But in download folder:
Env
react-native: "0.72.4" react-native-blob-util: "0.17.1" Android API Level: API 30
Important Informations
- I have already tested with versions "0.19.4" and "0.19.6" from react-native-blob-util
- Android 6 and 13 are working fine
Did there already exist a file with the same name? Some Android versions were struggling if the filename was already used. That's the reason for me asking
This error always happens if there exists a file with the same name. The second file will be either empty or produce an error. Any ideas for fixing this?