Fix bug 523860 - Do not escape double quote character " to \" in iCalendar output (potential RFC 2445 violation). r=mmecca
authorPhilipp Kewisch <mozilla@kewis.ch>
Thu, 28 Jul 2011 03:05:00 +0200
changeset 9204 34ea6b1cf02c0ef7fd1867a89a84c64227d99c86
parent 9203 02df7fdfbf98bbda76b95e74cbc03b93c90933a8
child 9205 a4324c58ecdc84532487347e06c1524ef5fa736c
push id230
push userbugzilla@standard8.plus.com
push dateTue, 08 Nov 2011 22:55:24 +0000
treeherdercomm-beta@63dad5648415 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmmecca
bugs523860
Fix bug 523860 - Do not escape double quote character " to \" in iCalendar output (potential RFC 2445 violation). r=mmecca
calendar/libical/src/libical/icalvalue.c
calendar/test/unit/test_bug523860.js
calendar/test/unit/xpcshell.ini
--- a/calendar/libical/src/libical/icalvalue.c
+++ b/calendar/libical/src/libical/icalvalue.c
@@ -306,17 +306,16 @@ static char* icalmemory_strdup_and_quote
 	    }
 	    case '\f': {
 		icalmemory_append_string(&str,&str_p,&buf_sz,"\\f");
 		break;
 	    }
 
 	    case ';':
 	    case ',':
-	    case '"':
 	    case '\\':{
 		icalmemory_append_char(&str,&str_p,&buf_sz,'\\');
 		icalmemory_append_char(&str,&str_p,&buf_sz,*p);
 		break;
 	    }
 
 	    default: {
 		icalmemory_append_char(&str,&str_p,&buf_sz,*p);
new file mode 100644
--- /dev/null
+++ b/calendar/test/unit/test_bug523860.js
@@ -0,0 +1,47 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla calendar tests code.
+ *
+ * The Initial Developer of the Original Code is
+ *   Philipp Kewisch <mozilla@kewis.ch>
+ * Portions created by the Initial Developer are Copyright (C) 2011
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+Components.utils.import("resource://calendar/modules/calUtils.jsm");
+
+function run_test() {
+    // In bug 523860, we found out that in the spec doublequotes should not be
+    // escaped.
+    let prop = cal.getIcsService().createIcalProperty("DESCRIPTION");
+    let expected = "A String with \"quotes\" and 'other quotes'";
+
+    prop.value = expected;
+    do_check_eq(prop.icalString, "DESCRIPTION:" + expected + "\r\n");
+}
--- a/calendar/test/unit/xpcshell.ini
+++ b/calendar/test/unit/xpcshell.ini
@@ -7,16 +7,17 @@ tail =
 [test_attendee.js]
 [test_bug272411.js]
 [test_bug343792.js]
 [test_bug350845.js]
 [test_bug356207.js]
 [test_bug485571.js]
 [test_bug486186.js]
 [test_bug494140.js]
+[test_bug523860.js]
 [test_bug668222.js]
 [test_datetime.js]
 [test_freebusy.js]
 [test_hashedarray.js]
 [test_ics.js]
 [test_providers.js]
 [test_recur.js]
 [test_relation.js]