You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by pu...@apache.org on 2014/08/29 03:14:53 UTC
[1/2] git commit: CB-7413 Adds support of 'ms-appdata://' URIs
Repository: cordova-plugin-file
Updated Branches:
refs/heads/master ba3243599 -> df66c4c41
CB-7413 Adds support of 'ms-appdata://' URIs
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/commit/8ee7aa82
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/tree/8ee7aa82
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/diff/8ee7aa82
Branch: refs/heads/master
Commit: 8ee7aa8264e190f7ff5e6fe2053b3a53bba1ea35
Parents: ad05e32
Author: Vladimir Kotikov <v-...@microsoft.com>
Authored: Wed Aug 27 16:58:41 2014 +0400
Committer: Vladimir Kotikov <v-...@microsoft.com>
Committed: Wed Aug 27 18:19:27 2014 +0400
----------------------------------------------------------------------
src/windows/FileProxy.js | 23 +++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/8ee7aa82/src/windows/FileProxy.js
----------------------------------------------------------------------
diff --git a/src/windows/FileProxy.js b/src/windows/FileProxy.js
index 4d65f28..8d36ddb 100644
--- a/src/windows/FileProxy.js
+++ b/src/windows/FileProxy.js
@@ -895,9 +895,8 @@ module.exports = {
resolveLocalFileSystemURI: function (success, fail, args) {
- var uri = cordovaPathToNative(args[0]);
-
- var path = uri;
+ var uri = args[0];
+ var path = cordovaPathToNative(uri);
// support for file name with parameters
if (/\?/g.test(path)) {
@@ -909,13 +908,21 @@ module.exports = {
path = decodeURI(path);
}
- // support for special path start with file:///
- if (path.substr(0, 8) == "file:///") {
- path = Windows.Storage.ApplicationData.current.localFolder.path + "\\" + String(path).substr(8);
+ var msappdataLocalPrefix = 'ms-appdata:///local/',
+ msappdataTempPrefix = 'ms-appdata:///temp/',
+ msappdataLocalPath = Windows.Storage.ApplicationData.current.localFolder.path + '\\',
+ msappdataTempPath = Windows.Storage.ApplicationData.current.temporaryFolder.path + '\\';
+
+ // support for special path start with file:/// or ms-appdata://
+ if (uri.indexOf("file:///") === 0 ) {
+ path = msappdataLocalPath + uri.substr(8).replace('/', '\\');
+ } else if (uri.indexOf(msappdataLocalPrefix) === 0) {
+ path = msappdataLocalPath + uri.replace(msappdataLocalPrefix, '').replace('/', '\\');
+ } else if (uri.indexOf(msappdataTempPrefix) === 0) {
+ path = msappdataTempPath + uri.replace(msappdataTempPrefix, '').replace('/', '\\');
} 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) {
+ if (path.indexOf(msappdataTempPath) != 0 && path.indexOf(msappdataLocalPath) != 0) {
fail(FileError.NOT_FOUND_ERR);
return;
}
[2/2] git commit: Merge branch 'CB-7413' of
https://github.com/MSOpenTech/cordova-plugin-file
Posted by pu...@apache.org.
Merge branch 'CB-7413' of https://github.com/MSOpenTech/cordova-plugin-file
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/commit/df66c4c4
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/tree/df66c4c4
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/diff/df66c4c4
Branch: refs/heads/master
Commit: df66c4c417643bb02a551c43e4d96142c5894c67
Parents: ba32435 8ee7aa8
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Thu Aug 28 18:15:34 2014 -0700
Committer: Jesse MacFadyen <pu...@gmail.com>
Committed: Thu Aug 28 18:15:34 2014 -0700
----------------------------------------------------------------------
src/windows/FileProxy.js | 23 +++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)
----------------------------------------------------------------------