Skip to content

Commit

Permalink
fix(parse): singleValue after multiValue parameter
Browse files Browse the repository at this point in the history
Fixes #386.
  • Loading branch information
caugner authored and kewisch committed Jan 13, 2020
1 parent f8174e8 commit 0ee23fc
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/ical/parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
26 changes: 26 additions & 0 deletions test/parse_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit 0ee23fc

Please sign in to comment.