Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No longer able to provide nested path #330

Open
boedy opened this issue Apr 20, 2022 · 0 comments
Open

No longer able to provide nested path #330

boedy opened this issue Apr 20, 2022 · 0 comments

Comments

@boedy
Copy link

boedy commented Apr 20, 2022

I believe #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 = 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

if(file == null){
    file = new File(targetUri.getPath());
}
file.getParentFile().mkdirs();
vantist added a commit to GSS-CRD/cordova-plugin-file-transfer that referenced this issue Apr 27, 2022
oddcb added a commit to systemfabrikken/cordova-plugin-file-transfer that referenced this issue Dec 22, 2022
I apache#330 endret oppførsel seg slik at nøstede kataloger ikke ble opprettet for filen som ble lastet ned.
jcaron23 added a commit to Netisse/cordova-plugin-file-transfer-tests that referenced this issue Jun 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant