[ https://issues.apache.org/jira/browse/CB-7266?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Kelvin Dart updated CB-7266: ---------------------------- Description: When I take a photo using, for example, the following code: {code:javascript} navigator.camera.getPicture( function (uri) { var image = document.getElementById('myImg'); image.src = uri; }, function () { // Do nothing for now }); {code} The uri returned in the success function is of the following format: {{ms-appdata:///local/camera_cordova_temp_return.jpg}}. Which is good! However, I am attempting to resolve this image to a b64 string, using window.resolveLocalFileSystemURL - but this is failing. I have debugged the problem and have noticed the issue is related to the following part of the function: {code} if (path.substr(0, 8) == "file:///") { path = Windows.Storage.ApplicationData.current.localFolder.path + "\\" + String(path).substr(8); } else { // method should not let read files outside of the [APP HASH]/Local or [APP HASH]/temp folders if (path.indexOf(Windows.Storage.ApplicationData.current.temporaryFolder.path) != 0 && path.indexOf(Windows.Storage.ApplicationData.current.localFolder.path) != 0) { fail && fail(FileError.ENCODING_ERR); return; } } {code} The code is only able to resolve either a URI of type {{C:\}} (an absolute path) or a {{file://}} protocol - nothing else (and so, never {{ms-appdata://}}). Can this be altered so ms-appdata can be resolved and I can convert my image to B64? Thanks *Edit:* the getPicture method does not have any parameter objects passed since the default parameters are sufficient. was: When I take a photo using, for example, the following code: {code:javascript} navigator.camera.getPicture( function (uri) { var image = document.getElementById('myImg'); image.src = uri; }, function () { // Do nothing for now }); {code} The uri returned in the success function is of the following format: {{ms-appdata:///local/camera_cordova_temp_return.jpg}}. Which is good! However, I am attempting to resolve this image to a b64 string, using window.resolveLocalFileSystemURL - but this is failing. I have debugged the problem and have noticed the issue is related to the following part of the function: {code} if (path.substr(0, 8) == "file:///") { path = Windows.Storage.ApplicationData.current.localFolder.path + "\\" + String(path).substr(8); } else { // method should not let read files outside of the [APP HASH]/Local or [APP HASH]/temp folders if (path.indexOf(Windows.Storage.ApplicationData.current.temporaryFolder.path) != 0 && path.indexOf(Windows.Storage.ApplicationData.current.localFolder.path) != 0) { fail && fail(FileError.ENCODING_ERR); return; } } {code} The code is only able to resolve either a URI of type {{C:\}} (an absolute path) or a {{file://}} protocol - nothing else (and so, never {{ms-appdata://}}). Can this be altered so ms-appdata can be resolved and I can convert my image to B64? Thanks > Windows 8 - resolveLocalFileSystemURI fails when trying to resolve ms-appdata > URLs > ---------------------------------------------------------------------------------- > > Key: CB-7266 > URL: https://issues.apache.org/jira/browse/CB-7266 > Project: Apache Cordova > Issue Type: Bug > Components: Plugin File, Windows 8 > Affects Versions: 3.5.0 > Environment: Windows 8.1; Visual Studio 2013 Professional; Cordova > 3.5.0 (running on a WinRT Surface) > Reporter: Kelvin Dart > Assignee: Jesse MacFadyen > Priority: Critical > > When I take a photo using, for example, the following code: > {code:javascript} > navigator.camera.getPicture( > function (uri) { > var image = document.getElementById('myImg'); > image.src = uri; > }, > function () { > // Do nothing for now > }); > {code} > The uri returned in the success function is of the following format: > {{ms-appdata:///local/camera_cordova_temp_return.jpg}}. > Which is good! However, I am attempting to resolve this image to a b64 > string, using window.resolveLocalFileSystemURL - but this is failing. > I have debugged the problem and have noticed the issue is related to the > following part of the function: > {code} > if (path.substr(0, 8) == "file:///") { > path = Windows.Storage.ApplicationData.current.localFolder.path + "\\" > + String(path).substr(8); > } else { > // method should not let read files outside of the [APP HASH]/Local or > [APP HASH]/temp folders > if > (path.indexOf(Windows.Storage.ApplicationData.current.temporaryFolder.path) > != 0 && > > path.indexOf(Windows.Storage.ApplicationData.current.localFolder.path) != 0) { > fail && fail(FileError.ENCODING_ERR); > return; > } > } > {code} > The code is only able to resolve either a URI of type {{C:\}} (an absolute > path) or a {{file://}} protocol - nothing else (and so, never > {{ms-appdata://}}). > Can this be altered so ms-appdata can be resolved and I can convert my image > to B64? > Thanks > *Edit:* the getPicture method does not have any parameter objects passed > since the default parameters are sufficient. -- This message was sent by Atlassian JIRA (v6.2#6252)