[ 
https://issues.apache.org/jira/browse/CB-13481?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16214771#comment-16214771
 ] 

ASF GitHub Bot commented on CB-13481:
-------------------------------------

GitHub user imgx64 opened a pull request:

    https://github.com/apache/cordova-plugin-file/pull/221

    CB-13481: (android) Don't ask for permission to read file:///android_asset/

    ### Platforms affected
    Android 6+
    
    ### What does this PR do?
    Allow reading from `cordova.file.applicationDirectory` 
(`file:///android_asset/`) without asking the user for permission.
    
    ### What testing has been done on this change?
    Modified the code and ran it on an Android 6.0 device (See sample code in 
the JIRA bug).
    
    ### Checklist
    - [x] [Reported an issue](http://cordova.apache.org/contribute/issues.html) 
in the JIRA database
    - [x] Commit message follows the format: "CB-3232: (android) Fix bug with 
resolving file paths", where CB-xxxx is the JIRA ID & "android" is the platform 
affected.
    - [ ] Added automated test coverage as appropriate for this change.


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/imgx64/cordova-plugin-file patch-1

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/cordova-plugin-file/pull/221.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #221
    
----
commit 552465c76da7a48f5ff1ad62c27e6f16d62a18e7
Author: imgx64 <[email protected]>
Date:   2017-10-23T07:35:01Z

    CB-13481: Don't ask for permission to read file:///android_asset/

----


> file:///android_asset/ shouldn't require READ_EXTERNAL_STORAGE permission
> -------------------------------------------------------------------------
>
>                 Key: CB-13481
>                 URL: https://issues.apache.org/jira/browse/CB-13481
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: cordova-plugin-file
>    Affects Versions: Master
>         Environment: cordova-android 6.3.0. 
> Running on Android 6.0. 
>            Reporter: Ibrahim M. Ghazal
>
> On Android 6+, trying to read a file from 
> {{cordova.file.applicationDirectory}} ({{file:///android_asset/}}) opens the 
> runtime permissions window and asks the user "Allow AppName to access photos, 
> media, and files on your device?". This is obviously incorrect as the app 
> always has the permission to read its own assets.
> Sample code that shows the issue:
> {code}
> function log(a) {console.log(a);};
> resolveLocalFileSystemURL(cordova.file.applicationDirectory, 
> function(applicationDirectory) {
>   applicationDirectory.getFile('www/index.js', {}, log, log);
> }, log);
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

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

Reply via email to