From 0ee23fc364524789595e177e193972461d068460 Mon Sep 17 00:00:00 2001 From: Claas Augner Date: Fri, 5 Apr 2019 17:54:55 +0200 Subject: [PATCH] fix(parse): singleValue after multiValue parameter Fixes #386. --- lib/ical/parse.js | 2 ++ test/parse_test.js | 26 ++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/lib/ical/parse.js b/lib/ical/parse.js index 6137fc74..73eef8f3 100644 --- a/lib/ical/parse.js +++ b/lib/ical/parse.js @@ -345,6 +345,8 @@ ICAL.parse = (function() { throw new ParserError("Empty parameter name in '" + line + "'"); } lcname = name.toLowerCase(); + mvdelim = false; + multiValue = false; if (lcname in designSet.param && designSet.param[lcname].valueType) { type = designSet.param[lcname].valueType; diff --git a/test/parse_test.js b/test/parse_test.js index 111a1581..153e16bc 100644 --- a/test/parse_test.js +++ b/test/parse_test.js @@ -210,6 +210,32 @@ suite('parserv2', function() { expected ); }); + + test('with comma in singleValue parameter', function() { + var input = ';LABEL="A, B"'; + var expected = { + 'label': 'A, B' + }; + + assert.deepEqual( + subject._parseParameters(input, 0, ICAL.design.components.vcard)[0], + expected + ); + }); + + test('with comma in singleValue parameter after multiValue parameter', function() { + // TYPE allows multiple values, whereas LABEL doesn't. + var input = ';TYPE=home;LABEL="A, B"'; + var expected = { + 'type': 'home', + 'label': 'A, B' + }; + + assert.deepEqual( + subject._parseParameters(input, 0, ICAL.design.components.vcard)[0], + expected + ); + }); }); test('#_parseMultiValue', function() {