Open boedy opened 2 years ago
I believe https://github.com/apache/cordova-plugin-file-transfer/pull/310 broke the previous behaviour. It was possible to provide a nested path as target file. Now it will throw an error when doing so.
(() => { const fileTransfer = new FileTransfer(); const url = 'http://cordova.apache.org/static/img/cordova_bot.png' const filePath = window.cordova.file.dataDirectory + 'nested/test.png'; fileTransfer.download( url, filePath, file => console.log(file), error => console.error(error) ); })()
Adding this code snippet after line 727
if(file == null){ file = new File(targetUri.getPath()); } file.getParentFile().mkdirs();
I believe https://github.com/apache/cordova-plugin-file-transfer/pull/310 broke the previous behaviour. It was possible to provide a nested path as target file. Now it will throw an error when doing so.
Code to reproduce
Possible fix
Adding this code snippet after line 727