From 560cff38e219a4fab4c3579bbfd8b6a86e52591b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=B8=D0=BB=D1=8F=D0=BD=20=D0=9F=D0=B0=D0=BB=D0=B0?= =?UTF-8?q?=D1=83=D0=B7=D0=BE=D0=B2?= Date: Tue, 29 Nov 2022 09:23:39 +0200 Subject: [PATCH] parser._handleContentLine() parsing including ^ in the parameter value MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Prior this change the property ATTENDEE=CN="Ж 4 <>'^':":mailto:1@example.org is read as: jCal: [ 'attendee', { cn: `Ж 4 <>'":` }, 'cal-address', '":mailto:1@example.org' ] The value starts with quote, which is wrong. --- lib/ical/parse.js | 2 ++ test/parser/property_params.ics | 1 + test/parser/property_params.json | 8 ++++++++ 3 files changed, 11 insertions(+) diff --git a/lib/ical/parse.js b/lib/ical/parse.js index ae85fca7..e0b7dfa1 100644 --- a/lib/ical/parse.js +++ b/lib/ical/parse.js @@ -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); diff --git a/test/parser/property_params.ics b/test/parser/property_params.ics index 522afdcb..e6c3697f 100644 --- a/test/parser/property_params.ics +++ b/test/parser/property_params.ics @@ -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:bar@baz.com";PAR TSTAT=ACCEPTED;RSVP=TRUE:mailto:foo@bar.com ATTENDEE;CN=X\:mailto:x@example.org diff --git a/test/parser/property_params.json b/test/parser/property_params.json index 1ce9abeb..c5a6db4c 100644 --- a/test/parser/property_params.json +++ b/test/parser/property_params.json @@ -58,6 +58,14 @@ "cal-address", "mailto:foo6@bar" ], + [ + "attendee", + { + "cn": "^Ж 4 <>\\'\"\n:" + }, + "cal-address", + "mailto:foo9@bar" + ], [ "attendee", {