Skip to content

Update ical.js: handle quoted param values #41

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions ical.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,20 +249,18 @@
i += 1
}

var kv = l.split(":")
var exp = /([^":;]+)((?:;(?:[^":;]+)(?:=(?:(?:"[^"]*")|(?:[^":;]+))))*):(.+)/;
var kv = l.match(exp);

if (kv.length < 2){
if (kv === null) {
// Invalid line - must have k&v
continue;
}
kv = kv.slice(1);

// Although the spec says that vals with colons should be quote wrapped
// in practise nobody does, so we assume further colons are part of the
// val
var value = kv.slice(1).join(":")
, kp = kv[0].split(";")
, name = kp[0]
, params = kp.slice(1)
var value = kv[kv.length - 1]
, name = kv[0]
, params = kv[1]?kv[1].split(';').slice(1):[]

ctx = self.handleObject(name, value, params, ctx, stack, l) || {}
}
Expand Down