Skip to content

Get two files when using Download Manager in Android 11 and one of them comes empty #325

Open

Description

@GabrielGomesBarbosa

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:

image

But in download folder:

image


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

Activity

  1. changed the title [-]Get two file when using Download Manager in Android 11 and one of them comes empty[/-] [+]Get two files when using Download Manager in Android 11 and one of them comes empty[/+] on Dec 14, 2023
  2. RonRadtke commented on Apr 7, 2024

    @RonRadtke
    Owner

    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

  3. UIT19521334 commented on Apr 22, 2024

    @UIT19521334

    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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions