arran4 / golang-ical

A ICS / ICal parser and serialiser for Golang.
Apache License 2.0
297 stars 73 forks source link

Events containing multiple `ATTENDEE`-Properties cause `Malformed Calendar`-Error #52

Closed JM-Lemmi closed 2 years ago

JM-Lemmi commented 2 years ago

This is the case for example in Google calendars, where different attendees have answered with different availibility.

issue52_attachments.zip

arran4 commented 2 years ago

Got it.. Thanks. Looking at it here: https://github.com/arran4/golang-ical/pull/53

arran4 commented 2 years ago

Okay I managed to pinpoint it to the parsing of this:

;X-RESPONSE-COMMENT="Abgelehnt\, weil ich au&szlig\;er Haus bin"

Once that's removed it works

arran4 commented 2 years ago

When I remove the \ characters it parses fine: X-RESPONSE-COMMENT="Abgelehnt, weil ich außer Haus bin"

It can handle the , and ; because they are quoted it seems. Escaping them seems to break it.

arran4 commented 2 years ago

I assume these were added by Google Calendar?

arran4 commented 2 years ago

The problem looks like I handled this way too simplistically:

        tokenPos = propertyParamValueReg.FindIndex([]byte(contentLine[p:]))

The regex doesn't consider \; as a possibility, as it seems that when (I think I wrote this) I wrote this I was thinking that the quotes " would be considered enough. Meaning I will have to write some sort of tokenizing logic here.

arran4 commented 2 years ago

I believe I have solved this. Can you verify it in the PR with a couple more tests?

https://github.com/arran4/golang-ical/pull/53