From 71700defc494a62e17d5d3bfb4402526ac879bd5 Mon Sep 17 00:00:00 2001 From: Chris Adams Date: Thu, 13 Jun 2019 15:49:10 +1000 Subject: [PATCH] [buteo-sync-plugins-social] Fix EX/RDATE parsing. Contributes to JB#46011 RFC5545 states that the valid formats for RDATE are: RDATE ";" "VALUE" "=" ("DATE-TIME" / "DATE" / "PERIOD") ":" RDATE ";" "TZID" "=" [tzidprefix] paramtext ":" Whereas our parsing code incorrectly omitted "VALUE=" prefix handling. --- .../google-calendars/googlecalendarsyncadaptor.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/google/google-calendars/googlecalendarsyncadaptor.cpp b/src/google/google-calendars/googlecalendarsyncadaptor.cpp index 23341aa..8f3b7aa 100644 --- a/src/google/google-calendars/googlecalendarsyncadaptor.cpp +++ b/src/google/google-calendars/googlecalendarsyncadaptor.cpp @@ -217,8 +217,8 @@ QList datetimesFromExRDateStr(const QString &exrdatestr, bool *isDate if (str.startsWith(';')) { str.remove(0,1); - if (str.startsWith("DATE-TIME:", Qt::CaseInsensitive)) { - str.remove(0, 10); + if (str.startsWith("VALUE=DATE-TIME:", Qt::CaseInsensitive)) { + str.remove(0, 16); QStringList dts = str.split(','); Q_FOREACH (const QString &dtstr, dts) { if (dtstr.endsWith('Z')) { @@ -233,15 +233,15 @@ QList datetimesFromExRDateStr(const QString &exrdatestr, bool *isDate retn.append(kdt); } } - } else if (str.startsWith("DATE:", Qt::CaseInsensitive)) { - str.remove(0, 5); + } else if (str.startsWith("VALUE=DATE:", Qt::CaseInsensitive)) { + str.remove(0, 11); QStringList dts = str.split(','); Q_FOREACH(const QString &dstr, dts) { QDate date = QLocale::c().toDate(dstr, RFC5545_QDATE_FORMAT); KDateTime kdt(date, KDateTime::Spec::ClockTime()); retn.append(kdt); } - } else if (str.startsWith("PERIOD:", Qt::CaseInsensitive)) { + } else if (str.startsWith("VALUE=PERIOD:", Qt::CaseInsensitive)) { SOCIALD_LOG_ERROR("unsupported parameter in ex/rdate string:" << exrdatestr); // TODO: support PERIOD formats, or just switch to CalDAV for Google sync... } else if (str.startsWith("TZID=") && str.contains(':')) {