hako2008 opened a new issue, #376: URL: https://github.com/apache/cordova-plugin-file-transfer/issues/376
# Bug Report Hi ! I'm currently unable to make the plugin work properly. ## Problem FileTransfer.download is failing with an error code 1 ``` { "code":1, "source":"https://mydomain.com/uploads/profiles/passengers/15/a5dfc010d9d4937820d9663a23a931eefaf51dcb.jpg", "target":"file:///data/user/0/com.myapp.name/images/profile/a5dfc010d9d4937820d9663a23a931eefaf51dcb.jpg", "http_status":200, "body":null, "exception":"/data/user/0/com.myapp.name/images/profile/a5dfc010d9d4937820d9663a23a931eefaf51dcb.jpg: open failed: ENOENT (No such file or directory)" } ``` The weird thing is sometimes work just fine, the same code the same app works fine sometimes gives the error. The weirdest thing is i have another app with the same code it works just fine. ### What is expected to happen? ### What does actually happen? ## Information when i tried to create the directory using the file system sometimes create normally in another time can't created and gives error code : 12 ``` function writeFile() { console.log(cordova.file.applicationStorageDirectory); window.resolveLocalFileSystemURL(cordova.file.applicationStorageDirectory, function(fileSystem){ var entry = ""; entry = fileSystem; console.log(entry); entry.getDirectory("images/profile", { create: true }, onGetDirectorySuccess, onGetDirectoryFail); }, onError); } function onError(e) { console.error({"onError":e}); }; function onGetDirectoryFail(dir) { console.log({"directory does not created!!!!!":dir}); }; function onGetDirectorySuccess(dir) { console.log({"directory created.":dir}); }; ``` i have the WRITE_EXTERNAL_STORAGE permission ``` <uses-permission android:maxSdkVersion="32" android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.READ_MEDIA_IMAGES" /> <uses-permission android:name="android.permission.READ_MEDIA_VIDEO" /> ``` even i asking for the permission of the app hasn't ``` var permissions = cordova.plugins.permissions; permissions.checkPermission(permissions.WRITE_EXTERNAL_STORAGE, function (status) { if (!status.hasPermission) { console.error('hasPermission no STORAGE permissions: '); console.log(status); requestPermissions(); } }, function (error) { console.error('Error checking permissions: ' + error); }); function requestPermissions() { permissions.requestPermission( permissions.WRITE_EXTERNAL_STORAGE, function (status) { if (!status.hasPermission) { console.error('Permission not granted'); }else{ console.log({'hasPermissionWRITE_EXTERNAL_STORAGE':status}); } }, function (error) { console.error('Error requesting permissions: ' + error); } ); } ``` ### Command or Code <!-- What command or code is needed to reproduce the problem? --> ``` var uri = encodeURI("https://mydomain.com"+response['success']['img']); var newNam = response['success']['img'].substring(response['success']['img'].lastIndexOf('/')+1); console.log('cordova.file.applicationStorageDirectory : '+cordova.file.applicationStorageDirectory); console.log('cordova.file.dataDirectory : '+cordova.file.dataDirectory); fileTransfer.download( uri, cordova.file.applicationStorageDirectory+'images/profile/' + newNam, function(entry) { EmptyDir(cordova.file.applicationStorageDirectory+'images/profile/',newNam); console.log("download complete: " + entry.toURL()); }, function(error) { console.log('download error message:'); console.log(error); }, false, { headers: { "Authorization": "Basic dGVzdHV23ZXNuYW1lOnSlc3RwYXN5029yZA==" } } ); ``` ### Environment, Platform, Device <!-- In what environment, on what platform or on which device are you experiencing the issue? --> Cordova @12 cordova-android@12.0.1 cordova-plugin-file-transfer 2.0.1-dev cordova-plugin-file 8.0.1 android-targetSdkVersion 33 ### Version information <!-- What are relevant versions you are using? For example: Cordova: Cordova CLI, Cordova Platforms, Cordova Plugins Other Frameworks: Ionic Framework and CLI version Operating System, Android Studio, Xcode etc. --> ## Checklist <!-- Please check the boxes by putting an x in the [ ] like so: [x] --> - [ ] I searched for existing GitHub issues - [ ] I updated all Cordova tooling to most recent version - [ ] I included all the necessary information above -- 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: issues-unsubscr...@cordova.apache.org.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org