Open alexisGandar opened 9 months ago
@alexisGandar , can you test the main branch to see if this issue still exists?
There is a PR that was merged in recently. It fixed an issue in the hasWritePermission
method. I believe it might might have fixed this issue as well. If it did, this issue and the PR #587, which you submitted, could be closed.
Can you confirm?
Bug Report
When writing file in this path " window.cordova.file.externalRootDirectory + 'Download' " it always throws a permission error on getFile action. The bug occur when upgrading on cordova-plugin-file V8 and cordova-android V12 and only on device with Android 10 and bellow. It does work on cordova-plugin-file V7 and cordova-android V11
Problem
The modal that request user authorisation for writing (WRITE_EXTERNAL_STORAGE) does not pop on screen witch lead to an INVALID_MODIFICATION_ERR (code 9) because the permission is not granted
What is expected to happen?
The modal that request the permission is displayed.
What does actually happen?
The modal does not appear
Information
I found out that when writing a file the following action are executed in FileUtils.java :
The permission is checked on the "Write" step but on Android 10 (for reasons that I can't explain) the permission seems to be required at the GetFile steps.
I did patch this issus by editing the GetFile steps in order to always ask for permission if needed on this step but I am not sure of the concequencies of this edit : see pull request #587
Command or Code
To reproduce the problem try to save a file with "writeFile" to " window.cordova.file.externalRootDirectory + 'Download'
Environment, Platform, Device
Android 10 with cordova-plugin-file V8 and cordova-android V12
Checklist