Skip to content

Commit

Permalink
parse._parsedParameters: do not use helpers.unescapedIndexOf()
Browse files Browse the repository at this point in the history
iCalendar and vCard parameters do not use \ as escape character in the
property parameter values, hence cn="\"X" is not a quote X, but invalid.
The proper escape character is ^ per RFC 6868.  This change replaces
helpers.unescapedIndexOf(x,…) with x.indexOf(…) in order not to

kewisch#536
ES6-ready
  • Loading branch information
dilyanpalauzov committed Apr 20, 2024
1 parent 82445c8 commit e43cf1c
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 12 deletions.
4 changes: 1 addition & 3 deletions lib/ical/parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -388,9 +388,7 @@ parse._parseParameters = function(line, start, designSet) {
}
value = line.slice(valuePos, pos);
lastParam = line.indexOf(PARAM_DELIMITER, pos);
let propValuePos = line.indexOf(VALUE_DELIMITER, pos);
// if either no next parameter or delimeter in property value, let's stop here
if (lastParam === -1 || (propValuePos !== -1 && lastParam > propValuePos)) {
if (lastParam === -1) {
pos = false;
}
} else {
Expand Down
1 change: 0 additions & 1 deletion test/parser/property_params.ics
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ ATTENDEE;ROLE="REQ-PARTICIPANT;foo";DELEGATED-FROM="mailto:[email protected]";PAR
TSTAT=ACCEPTED;RSVP=TRUE:mailto:[email protected]
ATTENDEE;CN=X\:mailto:[email protected]
ATTENDEE;CN="Y\":mailto:[email protected]
ATTENDEE;CN="Z\;":mailto:[email protected]
X-FOO;PARAM1=VAL1:FOO;BAR
X-FOO2;PARAM1=VAL1;PARAM2=VAL2:FOO;BAR
X-BAR;PARAM1="VAL1:FOO":BAZ;BAR
Expand Down
8 changes: 0 additions & 8 deletions test/parser/property_params.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,6 @@
"cal-address",
"mailto:[email protected]"
],
[
"attendee",
{
"cn": "Z\\;"
},
"cal-address",
"mailto:[email protected]"
],
[
"x-foo",
{
Expand Down

0 comments on commit e43cf1c

Please sign in to comment.