[Bedework-commit] carddav r258 -
trunk/clients/javascript/bwAddrbookClient/resources
svnadmin at bedework.org
svnadmin at bedework.org
Mon Feb 14 13:53:29 EST 2011
Author: bleibson
Date: 2011-02-14 13:53:27 -0500 (Mon, 14 Feb 2011)
New Revision: 258
Modified:
trunk/clients/javascript/bwAddrbookClient/resources/vcardParser.js
Log:
fix for empty parameters
Modified: trunk/clients/javascript/bwAddrbookClient/resources/vcardParser.js
===================================================================
--- trunk/clients/javascript/bwAddrbookClient/resources/vcardParser.js 2011-02-14 15:57:30 UTC (rev 257)
+++ trunk/clients/javascript/bwAddrbookClient/resources/vcardParser.js 2011-02-14 18:53:27 UTC (rev 258)
@@ -38,11 +38,13 @@
}
function cleanUpString (string) {
+ if ( string == "" ) {
+ return string;
+ }
// replace one or more backslashes followed by comma with comma
// replace double-quote with backslash double-quote (escape it)
// replace one or more backslashes followed by a semi-colon with a semi-colon
cleanedString = string.replace(/\\+,/g,",").replace(/"/g,'\\"').replace(/\\+;/g,";");
-
return cleanedString;
}
@@ -194,7 +196,11 @@
// THIS ISN'T COMPLETE -- NEED to split on comma, too.
bwJsonObj += '"parameter-name": "' + cleanUpString(equalsSplit[0]) + '",'
- bwJsonObj += '"parameter-value": "' + cleanUpString(equalsSplit[1]) + '"'
+ if (equalsSplit.length == 1) {
+ bwJsonObj += '"parameter-value": ""'
+ } else {
+ bwJsonObj += '"parameter-value": "' + cleanUpString(equalsSplit[1]) + '"'
+ }
//add a comma between parameters (avoid adding at end)
if (n != semiColonSplit.length - 1) {
@@ -277,4 +283,4 @@
}
}
return vcards;
-}
\ No newline at end of file
+}
More information about the Bedework-commit
mailing list