You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by GitBox <gi...@apache.org> on 2022/04/20 16:08:31 UTC

[GitHub] [cordova-plugin-file-transfer] boedy opened a new issue, #330: No longer able to provide nested path

boedy opened a new issue, #330:
URL: https://github.com/apache/cordova-plugin-file-transfer/issues/330

   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
   ```
   (() => {
     const fileTransfer = new FileTransfer();
     const url = 'http://cordova.apache.org/static/img/cordova_bot.png'
     const filePath = 'cdv'+window.cordova.file.dataDirectory + 'nested/test.png';
   
     fileTransfer.download(
       url,
       filePath,
       file => console.log(file),
       error => console.error(error)
     );
   })()
   ```
   
   ## Possible fix
   Adding this code snippet after [line 727](https://github.com/kpatfln/cordova-plugin-file-transfer/blob/2cdb0403a81821e144998c8d9a00d338d6ece3ee/src/android/FileTransfer.java#L727)
   ```
   if(file == null){
       file = new File(targetUri.getPath());
       file.mkdirs();
   }
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org