1

Issue

download not working on iOS for files without extension with error message "protocol error" but works on android if I put a file url like this https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf it works fine.

I'm using this lib rn-fetch-blob

Please help!

React Native version

0.61.2

Library version

0.12.0

My Code

var url = "https://exmple.com/dompdf?date=" + this.state.date + "&token=" + token;
const { config, fs } = RNFetchBlob
const dirToSave = Platform.select({
    ios: fs.dirs.DocumentDir,
    android: fs.dirs.DownloadDir
});
let options = {
    fileCache: true,
    addAndroidDownloads: {
        useDownloadManager: true,
        notification: true,
        path: dirToSave + "/filename.pdf",
        description: 'PDF',
        mime: 'application/pdf',
    }
}
try {
    config(options).fetch('GET', url).then((res) => {
        console.log('download OK');
    }).catch((error) => {
        console.log(error.message);
    });
} catch (error) {
    console.log(error.message);
}
Dev strange
  • 138
  • 1
  • 2
  • 10

0 Answers0