erisu commented on issue #545:
URL: 
https://github.com/apache/cordova-plugin-file/issues/545#issuecomment-1318096084

   I dont work with `content://` URLs so I cant give any answer or solution, 
but only feedback from my what I read.
   
   After reviewing the 
[**cordova-plugin-grant-fs-access**](https://github.com/vldmrrr/cordova-plugin-grant-fs-access)
 plugin source code, the sample app, and Android docs, I think the plugin is 
trying to access a restricted directory and failing.
   
   I beleive an empty `URI` string, that is being passed into the 
`getDirectory` method, results in targeting the root directory.
   
   From Android Docs, 
[`EXTRA_INITIAL_URI`](https://developer.android.com/reference/android/provider/DocumentsContract#EXTRA_INITIAL_URI)
 says:
   
   > Location should specify a document URI or a tree URI with document ID. If 
this URI identifies a non-directory, document navigator will attempt to use the 
parent of the document as the initial location.
   
   I believe the empty string hits the if condition and `will attempt to use 
the parent`, which I suspect is root.
   
   Base on the [Access 
Restrictions](https://developer.android.com/training/data-storage/shared/documents-files#document-tree-access-restrictions)
 of using `ACTION_OPEN_DOCUMENT_TREE` on Android 11 (API 30) and higher, the 
plugin fails on the first two items below.
   
   > On Android 11 (API level 30) and higher, you cannot use the 
ACTION_OPEN_DOCUMENT_TREE intent action to request access to the following 
directories:
   > 
   > * The root directory of the internal storage volume.
   > * The root directory of each SD card volume that the device manufacturer 
considers to be reliable, regardless of whether the card is emulated or 
removable. A reliable volume is one that an app can successfully access most of 
the time.
   > * The Download directory.
   > 
   > Furthermore, on Android 11 (API level 30) and higher, you cannot use the 
ACTION_OPEN_DOCUMENT_TREE intent action to request that the user select 
individual files from the following directories:
   > 
   > * The Android/data/ directory and all subdirectories.
   > * The Android/obb/ directory and all subdirectories.
   
   As I never worked with `content` URLs, I dont know the valid test cases.
   Also, if there is an issue, I would suggest for a reproduction branch 
without any third-party plugins. Only `cordova-plugin-file`.


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to