cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <>
Subject [jira] [Commented] (CB-9891) Inconsistent URI encoding causing permission errors on android
Date Thu, 12 Nov 2015 00:18:11 GMT


ASF GitHub Bot commented on CB-9891:

GitHub user jasongin opened a pull request:

    CB-9891: Fix permission errors due to URI encoding inconsistency on Android


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

    $ git pull CB-9891

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

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

    This closes #148
commit ef93b58cecc433382f125702934e3ed30d995eb3
Author: Jason Ginchereau <>
Date:   2015-11-11T20:05:32Z

    CB-9891: Fix permission errors due to URI encoding inconsistency on Android


> Inconsistent URI encoding causing permission errors on android
> --------------------------------------------------------------
>                 Key: CB-9891
>                 URL:
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Plugin Camera, Plugin File
>    Affects Versions: 2.1.0, 3.0.0
>         Environment: Android 5+
>            Reporter: Connor Pearson
>            Assignee: Jason Ginchereau
>              Labels: Android, reproduced
> Using the camera plugin to get a picture from the photo library returns an encoded URI.
If you then call resolveLocalFileSystemURI the fileEntry object returned contains the decoded
path component of the URI. This path property is used in the toInternalURL function which
means it's also decoded. Because Android gave us permission to the encoded URI, but not the
decoded URI, attempting to access the decoded URI results in a permission error. 
> {code:javascript}
> document.getElementById("myButton").addEventListener("click", function(){
>   {
>                 console.log(uri); //content://
> 		window.resolveLocalFileSystemURI(uri, function(fileEntry){
>                     console.log(fileEntry.toInternalURL()); //cdvfile://localhost/content/
>                     fileEntry.file(function(){alert("success");}, function(){alert("fail");});
>                 },function(error){
>                     // resolved by pulling in PR 119
>                     alert("Fail resolveFileSystemURI code: " + error.code);
>                 });
>             }, null, {sourceType: 0, allowEdit: false});
>         });
> {code}
> I feel like something must be wrong in one of the plugins, but I'm not sure where.
> One possible fix is calling uri.getEncodedPath() instead of uri.getPath in LocalFileSystemURL.parse
and then removing the call to encodeURI() from FileSystem.js, but I'm not sure if this is
the right strategy. [Example|]

This message was sent by Atlassian JIRA

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message