diff --git a/lib/ical/design.js b/lib/ical/design.js index cfd9fbd2..1778df65 100644 --- a/lib/ical/design.js +++ b/lib/ical/design.js @@ -193,7 +193,7 @@ let commonValues = { let icalParams = { // Although the syntax is DQUOTE uri DQUOTE, I don't think we should - // enfoce anything aside from it being a valid content line. + // enforce anything aside from it being a valid content line. // // At least some params require - if multi values are used - DQUOTEs // for each of its values - e.g. delegated-from="uri1","uri2" diff --git a/lib/ical/stringify.js b/lib/ical/stringify.js index 1a542862..82cc92c0 100644 --- a/lib/ical/stringify.js +++ b/lib/ical/stringify.js @@ -118,18 +118,16 @@ stringify.property = function(property, designSet, noFold) { } let multiValue = (paramName in designSet.param) && designSet.param[paramName].multiValue; if (multiValue && Array.isArray(value)) { - if (designSet.param[paramName].multiValueSeparateDQuote) { - multiValue = '"' + multiValue + '"'; - } value = value.map(stringify._rfc6868Unescape); + value = value.map(stringify.propertyValue); value = stringify.multiValue(value, multiValue, "unknown", null, designSet); } else { value = stringify._rfc6868Unescape(value); + value = stringify.propertyValue(value); } - line += ';' + paramName.toUpperCase(); - line += '=' + stringify.propertyValue(value); + line += ';' + paramName.toUpperCase() + '=' + value; } if (property.length === 3) { @@ -211,7 +209,6 @@ stringify.property = function(property, designSet, noFold) { * @return {String} Given or escaped value when needed */ stringify.propertyValue = function(value) { - if ((unescapedIndexOf(value, ',') === -1) && (unescapedIndexOf(value, ':') === -1) && (unescapedIndexOf(value, ';') === -1)) { diff --git a/test/stringify_test.js b/test/stringify_test.js index aecfa109..361cc700 100644 --- a/test/stringify_test.js +++ b/test/stringify_test.js @@ -173,5 +173,35 @@ suite('ICAL.stringify', function() { assert.equal(ICAL.stringify.component(subject), expected); }); + + test('multiple types unquoted', function() { + let subject = [ + "vcard", + [ + [ + "adr", + { + type: ["dom", "home", "postal", "parcel"] + }, + "text", + ["", "", "123 Main Street", "Any Town", "CA", "91921-1234"] + ], + [ + "tel", + { + type: ["home", "voice"] + }, + "phone-number", + "1234567" + ] + ] + ]; + let expected = + "BEGIN:VCARD\r\n" + + "ADR;TYPE=dom,home,postal,parcel:;;123 Main Street;Any Town;CA;91921-1234\r\n" + + "TEL;TYPE=home,voice:1234567\r\n" + + "END:VCARD"; + assert.equal(ICAL.stringify.component(subject), expected); + }); }); });