[
https://issues.apache.org/jira/browse/CB-13481?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16226564#comment-16226564
]
ASF GitHub Bot commented on CB-13481:
-------------------------------------
imgx64 closed pull request #221: CB-13481: (android) Don't ask for permission
to read file:///android_asset/
URL: https://github.com/apache/cordova-plugin-file/pull/221
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/src/android/FileUtils.java b/src/android/FileUtils.java
index 2b88d52..1d6e61f 100644
--- a/src/android/FileUtils.java
+++ b/src/android/FileUtils.java
@@ -570,6 +570,7 @@ private boolean hasWritePermission() {
private boolean needPermission(String nativeURL, int permissionType)
throws JSONException {
JSONObject j = requestAllPaths();
ArrayList<String> allowedStorageDirectories = new ArrayList<String>();
+ allowedStorageDirectories.add(j.getString("applicationDirectory"));
allowedStorageDirectories.add(j.getString("applicationStorageDirectory"));
if(j.has("externalApplicationStorageDirectory")) {
allowedStorageDirectories.add(j.getString("externalApplicationStorageDirectory"));
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> 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]