AleFons opened a new issue #397: URL: https://github.com/apache/cordova-plugin-file/issues/397
# Bug Report ## Problem ### What is expected to happen? It should be able to access public files. ### What does actually happen? When attempting to access a file from outside the app's dataDirectory on Android 10, the plugin returns a `FILE_NOT_FOUND_ERR`. ## Information <!-- Include all relevant information that might help understand and reproduce the problem --> Android 10 comes with [some changes in privacy](https://developer.android.com/about/versions/10/privacy/changes) that seem to be the cause; this problem specifically happens to me when I use the Camera plugin to select a picture from the photo roll and make a backup of it; when attempting to copy it to the app's directory, I get that error. ### Command or Code <!-- What command or code is needed to reproduce the problem? --> ``` public async backupAnnexedFile(content_uri) { let link = content_uri; if (this.platform.is('android')) { link = await this.file_path.resolveNativePath(content_uri); } let old_path = link.slice(0, link.lastIndexOf('/') + 1); let old_filename = link.slice(link.lastIndexOf('/') + 1, link.length); let extension = old_filename.slice(old_filename.lastIndexOf('.'), old_filename.length); let new_path = 'path/to/file/'; if (this.platform.is('cordova')) { new_path = this.fileHandler.dataDirectory.toString(); } let new_filename = 'L_'; new_filename = `${new_filename}${Date.now()}${extension}`; await this.fileHandler.copyFile(old_path, old_filename, new_path, new_filename).catch((error) => { console.log(error); throw error; }); return `${new_path}${new_filename}`; } ``` ### Environment, Platform, Device <!-- In what environment, on what platform or on which device are you experiencing the issue? --> Android 10, has happened on multiple devices. ### 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. --> Ionic: ionic (Ionic CLI) : 4.6.0 Ionic Framework : ionic-angular 3.9.6 @ionic/app-scripts : 3.2.4 Cordova: cordova (Cordova CLI) : 9.0.0 ([email protected]) Cordova Platforms : android 8.1.0, ios 5.0.0 Cordova Plugins : cordova-plugin-ionic-keyboard 2.0.5, cordova-plugin-ionic-webview 2.2.0, (and 18 other plugins) System: Android SDK Tools : 26.1.1 NodeJS : v12.16.3 npm : 6.14.4 OS : Linux 4.15 ## Checklist <!-- Please check the boxes by putting an x in the [ ] like so: [x] --> - [X] I searched for existing GitHub issues - [X] I updated all Cordova tooling to most recent version - [X] 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. For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
