rianjs / ical.net

ical.NET - an open source iCal library for .NET
MIT License
768 stars 228 forks source link

Recurrence parser does not follow RFC 5545 #438

Open Sharparam opened 5 years ago

Sharparam commented 5 years ago

There is an issue when parsing an RRULE string that does not begin with "FREQ". The current parser extracts the first occurrence of "FREQ" and everything following it, meaning that any properties that occurred before the first "FREQ" are ignored.

This is not according to RFC 5545, which states that "The rule parts are not ordered in any particular sequence.".

The problem starts with this regex pattern:

https://github.com/rianjs/ical.net/blob/master/net-core/Ical.Net/Serialization/DataTypes/RecurrencePatternSerializer.cs#L196

rianjs commented 5 years ago

Do you have some ics text that demonstrates the bug?

Sharparam commented 5 years ago

Any RRULE string where data comes before the FREQ property will have that data stripped.

image

In the first one where FREQ is first, COUNT is parsed correctly. In the second one where COUNT comes before FREQ, it is being ignored and set to the default value.