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 2012/05/24 23:44:03 UTC

[1/2] js commit: added sanity check for invalid urls, this should be extended to include every case identifiable without calling native.

Updated Branches:
  refs/heads/master 68eebbca4 -> 95f199e1c


added sanity check for invalid urls, this should be extended to include every case identifiable without calling native.


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/95f199e1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/tree/95f199e1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/diff/95f199e1

Branch: refs/heads/master
Commit: 95f199e1c207dc89b84e79a9a7b27d6a3cc8fe14
Parents: 88ab6e6
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Thu May 24 14:42:28 2012 -0700
Committer: Jesse MacFadyen <pu...@gmail.com>
Committed: Thu May 24 14:42:28 2012 -0700

----------------------------------------------------------------------
 lib/common/plugin/resolveLocalFileSystemURI.js |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/95f199e1/lib/common/plugin/resolveLocalFileSystemURI.js
----------------------------------------------------------------------
diff --git a/lib/common/plugin/resolveLocalFileSystemURI.js b/lib/common/plugin/resolveLocalFileSystemURI.js
index adb48f1..68981df 100644
--- a/lib/common/plugin/resolveLocalFileSystemURI.js
+++ b/lib/common/plugin/resolveLocalFileSystemURI.js
@@ -16,10 +16,16 @@ module.exports = function(uri, successCallback, errorCallback) {
             errorCallback(new FileError(error));
         }
     };
+    // sanity check for 'not:valid:filename'
+    if(!uri || uri.split(":").length > 2) {
+        setTimeout( function() {
+            fail(FileError.ENCODING_ERR);
+        },0);
+        return;
+    }
     // if successful, return either a file or directory entry
     var success = function(entry) {
         var result;
-
         if (entry) {
             if (typeof successCallback === 'function') {
                 // create appropriate Entry object