You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by GitBox <gi...@apache.org> on 2021/02/07 18:22:54 UTC

[GitHub] [cordova-plugin-file] LoranRendel opened a new issue #456: Can't read file outside of app dirs

LoranRendel opened a new issue #456:
URL: https://github.com/apache/cordova-plugin-file/issues/456


   # Bug Report
   
   ## Problem
   
   ### What is expected to happen?
   Successful file read
   
   ### What does actually happen?
   File error 1
   
   ## Information
   <!-- Include all relevant information that might help understand and reproduce the problem -->
   ![изображение](https://user-images.githubusercontent.com/7853801/107155635-8607e600-698a-11eb-9c75-22994ef9e932.png)
   
   ### Command or Code
   <!-- What command or code is needed to reproduce the problem? -->
   ```function readFile(fileEntry) {
           fileEntry.file(function (file) {
               console.log(file);
               var reader = new FileReader();
   
               reader.onloadend = function () {
                   console.log("Successful file read: " + this.result);
                   console.log(this);
               };
   
               reader.readAsText(file);
   
           }, onErrorReadFile);
       }
   
       function onErrorReadFile(e) {
           console.log('error: ' + e);
       }
   
       window.resolveLocalFileSystemURL(cordova.file.externalRootDirectory + "test.txt",
           readFile,
           function (e) {
               console.log('unable to read', e);
           }
       );```
   
   
   ### Environment, Platform, Device
   <!-- In what environment, on what platform or on which device are you experiencing the issue? -->
   Android 10
   
   
   ### 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.
   -->
   Cordova 9.0.0, Android 10, cordova-plugin-file 6.0.2
   
   
   ## 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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-plugin-file] breautek closed issue #456: Can't read file outside of app dirs

Posted by GitBox <gi...@apache.org>.
breautek closed issue #456:
URL: https://github.com/apache/cordova-plugin-file/issues/456


   


-- 
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-plugin-file] breautek commented on issue #456: Can't read file outside of app dirs

Posted by GitBox <gi...@apache.org>.
breautek commented on issue #456:
URL: https://github.com/apache/cordova-plugin-file/issues/456#issuecomment-830843495


   > I'd suggest to close this issue because it is a repetition of #426
   
   Agreed
   
   https://github.com/apache/cordova-plugin-file/issues/426#issuecomment-830841544


-- 
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-plugin-file] LoranRendel edited a comment on issue #456: Can't read file outside of app dirs

Posted by GitBox <gi...@apache.org>.
LoranRendel edited a comment on issue #456:
URL: https://github.com/apache/cordova-plugin-file/issues/456#issuecomment-778997716


   > 
   > 
   > This is **suppose** to work on API 29 with the `requestLegacyExternalStorage` enabled (which if you use the dev copy from github master branch, the plugin does use this flag). Can you try the plugin by installing it from git?
   > 
   > ```
   > cordova plugin add https://github.com/apache/cordova-plugin-file.git
   > ```
   > 
   > Please do let me know of this works, I'll be planning on making a release so that people can start making their migrations. Accessing the external storage root will not be possible starting API 30.
   
   Yes, now it works in Android 10 / API 29.
   
   However, will there be a solution to reading files in API 30? If application is designed to work with files it will be useless if there will be no way to access FS.
   
   P.S. Just read [notes about storage in Android 11](https://developer.android.com/about/versions/11/privacy/storage), `requestLegacyExternalStorage` will work in Android 11 if target API is still 29.


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-plugin-file] breautek commented on issue #456: Can't read file outside of app dirs

Posted by GitBox <gi...@apache.org>.
breautek commented on issue #456:
URL: https://github.com/apache/cordova-plugin-file/issues/456#issuecomment-779204868


   > However, will there be a solution to reading files in API 30? If application is designed to work with files it will be useless if there will be no way to access FS.
   
   Android is going to limit the ability to access the file system outside of your app's sandbox, so accessing these files won't be possible starting API 30 as they once were. Android has a `MediaStore` API that we either need to figure out how to implement within the file plugin or perhaps as an entirely new plugin. The MediaStore is no way alike the the FS API so it may be completely out of scope for this plugin.
   
   With that being said, there will be some external files that will become inaccessible starting API 30 as the MediaStore doesn't provide access to everything. For example, `cordova.file.externalRootDirectory + "test.txt"` will likely become impossible to access using the new APIs which will be enforced starting API 30. Likewise, if you have any custom folders that you used inside the external root directory, they'll become inaccessible. [Google](https://developer.android.com/about/versions/11/privacy/storage) states:
   
   > If your app uses the legacy storage model and previously targeted Android 10 or lower, you might be storing data in a directory that your app cannot access when the scoped storage model is enabled. Before you target Android 11, migrate data to a directory that's compatible with scoped storage.
   
   


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-plugin-file] LoranRendel commented on issue #456: Can't read file outside of app dirs

Posted by GitBox <gi...@apache.org>.
LoranRendel commented on issue #456:
URL: https://github.com/apache/cordova-plugin-file/issues/456#issuecomment-778997716


   > 
   > 
   > This is **suppose** to work on API 29 with the `requestLegacyExternalStorage` enabled (which if you use the dev copy from github master branch, the plugin does use this flag). Can you try the plugin by installing it from git?
   > 
   > ```
   > cordova plugin add https://github.com/apache/cordova-plugin-file.git
   > ```
   > 
   > Please do let me know of this works, I'll be planning on making a release so that people can start making their migrations. Accessing the external storage root will not be possible starting API 30.
   
   Yes, now it works in Android 10 / API 29.
   
   However, will there be a solution to reading files in API 30? If application is designed to work with files it will be useless if there will be no way to access FS.


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-plugin-file] jfoclpf commented on issue #456: Can't read file outside of app dirs

Posted by GitBox <gi...@apache.org>.
jfoclpf commented on issue #456:
URL: https://github.com/apache/cordova-plugin-file/issues/456#issuecomment-808556443


   I'd suggest to close this issue because it is a repetition of #426


-- 
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-plugin-file] breautek commented on issue #456: Can't read file outside of app dirs

Posted by GitBox <gi...@apache.org>.
breautek commented on issue #456:
URL: https://github.com/apache/cordova-plugin-file/issues/456#issuecomment-778711005


   This is **suppose** to work on API 29 with the `requestLegacyExternalStorage` enabled (which if you use the dev copy from github master branch, the plugin does use this flag). Can you try the plugin by installing it from git?
   
   ```
   cordova plugin add https://github.com/apache/cordova-plugin-file.git
   ```
   
   Please do let me know of this works, I'll be planning on making a release so that people can start making their migrations. Accessing the external storage root will not be possible starting API 30.


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org