Skip to content

Commit

Permalink
parser._handleContentLine() parsing including ^ in the parameter value
Browse files Browse the repository at this point in the history
Prior this change the property

  ATTENDEE=CN="Ж 4 <>'^':":mailto:[email protected]

is read as:

  jCal: [
    'attendee',
    { cn: `Ж 4 <>'":` },
    'cal-address',
    '":mailto:[email protected]'
  ]

The value starts with quote, which is wrong.
  • Loading branch information
dilyanpalauzov authored and kewisch committed Apr 13, 2024
1 parent 5f61c41 commit 560cff3
Show file tree
Hide file tree
Showing 3 changed files with 11 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 @@ -419,7 +419,9 @@ parse._parseParameters = function(line, start, designSet) {
value = line.slice(valuePos, nextPos);
}

const length_before = value.length;
value = parse._rfc6868Escape(value);
valuePos += length_before - value.length;
if (multiValue) {
let delimiter = mvdelim || multiValue;
value = parse._parseMultiValue(value, delimiter, type, [], null, designSet);
Expand Down
1 change: 1 addition & 0 deletions test/parser/property_params.ics
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ ATTENDEE;CN="Foo, Bar":mailto:foo3@bar
ATTENDEE;CN="Foo; Bar":mailto:foo4@bar
ATTENDEE;DELEGATED-TO="mailto:foo7@bar";CN="Foo, Bar":mailto:foo5@bar
ATTENDEE;DELEGATED-TO="mailto:foo7@bar";CN="Foo; Bar":mailto:foo6@bar
ATTENDEE;CN="^^Ж 4 <>\'^'^n:":mailto:foo9@bar
ATTENDEE;ROLE="REQ-PARTICIPANT;foo";DELEGATED-FROM="mailto:[email protected]";PAR
TSTAT=ACCEPTED;RSVP=TRUE:mailto:[email protected]
ATTENDEE;CN=X\:mailto:[email protected]
Expand Down
8 changes: 8 additions & 0 deletions test/parser/property_params.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,14 @@
"cal-address",
"mailto:foo6@bar"
],
[
"attendee",
{
"cn": "^Ж 4 <>\\'\"\n:"
},
"cal-address",
"mailto:foo9@bar"
],
[
"attendee",
{
Expand Down

0 comments on commit 560cff3

Please sign in to comment.