Kelvin Dart created CB-7266:
-------------------------------
Summary: 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:
{code}
ms-appdata:///local/camera_cordova_temp_return.jpg
{code}
Which is good! However, I am attempting to resolve this image to a b64 string,
using window.resolveFileSystem.URL - 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: or file:// - 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
--
This message was sent by Atlassian JIRA
(v6.2#6252)