incubator-callback-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tim...@apache.org
Subject [2/48] js commit: Fixed DirectoryEntry invalid paths and some comments
Date Thu, 07 Jun 2012 20:40:43 GMT
Fixed DirectoryEntry invalid paths and some comments


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/commit/0fd98cdc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/tree/0fd98cdc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/diff/0fd98cdc

Branch: refs/heads/master
Commit: 0fd98cdcd44666c608fab86f373c45e6aa682105
Parents: 7473931
Author: Tim Kim <tim.kim@nitobi.com>
Authored: Thu May 31 17:04:11 2012 -0700
Committer: Tim Kim <tim.kim@nitobi.com>
Committed: Thu Jun 7 13:40:24 2012 -0700

----------------------------------------------------------------------
 lib/playbook/plugin/playbook/DirectoryEntry.js     |   13 +++++++++++++
 lib/playbook/plugin/playbook/Entry.js              |    2 +-
 lib/playbook/plugin/playbook/FileReader.js         |    2 +-
 .../plugin/playbook/resolveLocalFileSystemURI.js   |    2 +-
 4 files changed, 16 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/0fd98cdc/lib/playbook/plugin/playbook/DirectoryEntry.js
----------------------------------------------------------------------
diff --git a/lib/playbook/plugin/playbook/DirectoryEntry.js b/lib/playbook/plugin/playbook/DirectoryEntry.js
index dd460c8..4feba9c 100644
--- a/lib/playbook/plugin/playbook/DirectoryEntry.js
+++ b/lib/playbook/plugin/playbook/DirectoryEntry.js
@@ -3,6 +3,8 @@ var DirectoryEntry = require('cordova/plugin/DirectoryEntry'),
     FileEntry = require('cordova/plugin/FileEntry'),
     FileError = require('cordova/plugin/FileError');
 
+var validFileRe = new RegExp('^[a-zA-Z][0-9a-zA-Z._]*$');
+
 module.exports = {
     createReader : function() {
         return new DirectoryReader(this.fullPath);
@@ -45,6 +47,12 @@ module.exports = {
             }
         };
 
+        // invalid path
+        if(!validFileRe.exec(path)){
+            fail(FileError.ENCODING_ERR);
+            return;
+        }
+
         // determine if path is relative or absolute
         if (!path) {
             fail(FileError.ENCODING_ERR);
@@ -143,6 +151,11 @@ module.exports = {
             }
         };
 
+        // invalid path
+        if(!validFileRe.exec(path)){
+            fail(FileError.ENCODING_ERR);
+            return;
+        }
         // determine if path is relative or absolute
         if (!path) {
             fail(FileError.ENCODING_ERR);

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/0fd98cdc/lib/playbook/plugin/playbook/Entry.js
----------------------------------------------------------------------
diff --git a/lib/playbook/plugin/playbook/Entry.js b/lib/playbook/plugin/playbook/Entry.js
index bf7ea75..fc604c5 100644
--- a/lib/playbook/plugin/playbook/Entry.js
+++ b/lib/playbook/plugin/playbook/Entry.js
@@ -80,7 +80,7 @@ module.exports = {
                 }
             };
 
-        // Entry object is borked 
+        // Entry object is borked
         var theEntry = {};
         var dstPath = parent.fullPath + '/' + name;
         if(this.isFile){

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/0fd98cdc/lib/playbook/plugin/playbook/FileReader.js
----------------------------------------------------------------------
diff --git a/lib/playbook/plugin/playbook/FileReader.js b/lib/playbook/plugin/playbook/FileReader.js
index 1f75998..8591f9c 100644
--- a/lib/playbook/plugin/playbook/FileReader.js
+++ b/lib/playbook/plugin/playbook/FileReader.js
@@ -108,7 +108,7 @@ FileReader.prototype.readAsText = function(file, encoding) {
                 }
             }
         }
-        // setting asynch to off 
+        // setting asynch to off
         blackberry.io.file.readFile(this.fileName, getFileContents, false);
 
     }else{

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/0fd98cdc/lib/playbook/plugin/playbook/resolveLocalFileSystemURI.js
----------------------------------------------------------------------
diff --git a/lib/playbook/plugin/playbook/resolveLocalFileSystemURI.js b/lib/playbook/plugin/playbook/resolveLocalFileSystemURI.js
index b52bcf3..909235a 100644
--- a/lib/playbook/plugin/playbook/resolveLocalFileSystemURI.js
+++ b/lib/playbook/plugin/playbook/resolveLocalFileSystemURI.js
@@ -36,7 +36,7 @@ module.exports = function(uri, successCallback, errorCallback) {
             fail(FileError.NOT_FOUND_ERR);
         }
     };
-    
+
     // Entry object is borked - unable to instantiate a new Entry object so just create one
     var theEntry = {};
     if(blackberry.io.dir.exists(uri)){


Mime
View raw message