aboutsummaryrefslogtreecommitdiff
path: root/js/io/system/coreioapi.js
diff options
context:
space:
mode:
authorAnanya Sen2012-02-02 12:59:41 -0800
committerAnanya Sen2012-02-02 12:59:41 -0800
commit476a25e8a662270dfe5b37c560e4235f02b146e4 (patch)
tree11fbb125e67e09e8b245c84370c1526e9841188f /js/io/system/coreioapi.js
parente806afea0eb1b66ac457471983db0e3d5942d222 (diff)
downloadninja-476a25e8a662270dfe5b37c560e4235f02b146e4.tar.gz
uri validation moved to file io apis
Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com>
Diffstat (limited to 'js/io/system/coreioapi.js')
-rwxr-xr-xjs/io/system/coreioapi.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/js/io/system/coreioapi.js b/js/io/system/coreioapi.js
index f4ab56b6..f0ca568f 100755
--- a/js/io/system/coreioapi.js
+++ b/js/io/system/coreioapi.js
@@ -983,6 +983,27 @@ exports.CoreIoApi = Montage.create(Component, {
983 return retValue; 983 return retValue;
984 } 984 }
985 }, 985 },
986
987 /***
988 * checks for valid uri pattern
989 * also flags if Windows uri pattern and Unix uri patterns are mixed
990 */
991 isValidUri:{
992 value: function(uri){
993 var isWindowsUri=false, isUnixUri=false,status=false;
994 if(uri !== ""){
995 uri = uri.replace(/^\s+|\s+$/g,""); // strip any leading or trailing spaces
996
997 //for local machine folder uri
998 isWindowsUri = /^([a-zA-Z]:)(\\[^<>:"/\\|?*]+)*\\?$/gi.test(uri);
999 isUnixUri = /^(\/)?(\/(?![.])[^/]*)*\/?$/gi.test(uri);//folders beginning with . are hidden on Mac / Unix
1000 status = isWindowsUri || isUnixUri;
1001 if(isWindowsUri && isUnixUri){status = false;}
1002 }
1003 return status;
1004 }
1005 },
1006
986 //////////////////////////////////////////////////////////////////// 1007 ////////////////////////////////////////////////////////////////////
987 /*** 1008 /***
988 * check if the file exists 1009 * check if the file exists