react-native-blob-util icon indicating copy to clipboard operation
react-native-blob-util copied to clipboard

Download doesn't work with redirect

Open JameDodgers opened this issue 2 years ago • 1 comments

Hello, I'm having trouble trying to download a file from my backend endpoint URL which redirects to the s3 server. After searching for a while, I found an issue in an old repository that may have something related to this. The progress function gives me -1 as total just as mentioned in the issue.

"react-native": "0.64.2", "react-native-blob-util": "^0.16.2",

Below are some of the configs that I am using

ReactNativeBlobUtil.config({
  fileCache: false,
  path,
  addAndroidDownloads: {
    useDownloadManager: true,
    notification: true,
    mime: 'application/pdf',
    mediaScannable: true,
    path,
  },
})
  .fetch('GET', url, {
    ...(accessToken && {
      Authorization: `Bearer ${accessToken}`,
    }),
  })

JameDodgers avatar Sep 16 '22 20:09 JameDodgers

The done promise should contain a field "redirects", did you check what is written there? IS this one filled correctly? And I assume it's a 302 redirect? I can't see anything wrong with the interceptores on a first glance. And followRedirect should be set to true. So I will have to dig deeper

RonRadtke avatar Oct 12 '22 08:10 RonRadtke