diff --git a/lib/ical/stringify.js b/lib/ical/stringify.js index f388cb2c..12415968 100644 --- a/lib/ical/stringify.js +++ b/lib/ical/stringify.js @@ -4,7 +4,7 @@ * Portions Copyright (C) Philipp Kewisch */ import design from "./design.js"; -import { foldline, unescapedIndexOf } from "./helpers.js"; +import { foldline } from "./helpers.js"; const LINE_ENDING = '\r\n'; const DEFAULT_VALUE_TYPE = 'unknown'; @@ -131,7 +131,6 @@ stringify.property = function(property, designSet, noFold) { value = stringify.paramPropertyValue(value); } - line += ';' + paramName.toUpperCase() + '=' + value; } @@ -216,9 +215,9 @@ stringify.property = function(property, designSet, noFold) { */ stringify.paramPropertyValue = function(value, force) { if (!force && - (unescapedIndexOf(value, ',') === -1) && - (unescapedIndexOf(value, ':') === -1) && - (unescapedIndexOf(value, ';') === -1)) { + (value.indexOf(',') === -1) && + (value.indexOf(':') === -1) && + (value.indexOf(';') === -1)) { return value; } diff --git a/test/stringify_test.js b/test/stringify_test.js index 40337b84..48a6714f 100644 --- a/test/stringify_test.js +++ b/test/stringify_test.js @@ -113,6 +113,13 @@ suite('ICAL.stringify', function() { delete ICAL.design.defaultSet.param.type; }); + test('stringify property value containing "escaped" semicolons, commas, colons', function() { + let subject = new ICAL.Property('attendee'); + subject.setParameter('cn', 'X\\:'); + subject.setValue('mailto:id'); + assert.equal(subject.toICALString(), 'ATTENDEE;CN="X\\:":mailto:id'); + }); + test('rfc6868 roundtrip', function() { let subject = new ICAL.Property('attendee'); let input = "caret ^ dquote \" newline \n end";