Open Bug 1849849 Opened 2 years ago Updated 1 year ago

Error when parsing Apple iCloud calendars (Error: Could not extract integer from ":3")

Categories

(Calendar :: ICAL.js Integration, defect)

Thunderbird 115
Desktop
macOS
defect

Tracking

(Not tracked)

UNCONFIRMED

People

(Reporter: db, Unassigned)

References

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36

Steps to reproduce:

Just subscribe to any of my iCloud calendars, and then open TB, these error messages are shown. The issue occurs when using native calendar addition in TB as well as with TBSync.
If needed I can provide temporary private access to one of my calendars to assist in resolving the issue.

Actual results:

The console reports errors such as:
13:37:39.380 Calendar: Error: Could not extract integer from ":3"
    strictParseInt resource:///modules/calendar/Ical.jsm:156
    fromDateTimeString resource:///modules/calendar/Ical.jsm:6076
    fromString resource:///modules/calendar/Ical.jsm:6100
    set icalString resource:///modules/CalDateTime.jsm:200
    createDateTime resource:///modules/calendar/calUtils.jsm:30
    set icalComponent resource:///modules/CalAlarm.jsm:559
    set icalString resource:///modules/CalAlarm.jsm:363
    CalAlarm resource:///modules/CalAlarm.jsm:38
    getAdditionalDataForItemMap resource:///modules/calendar/CalStorageItemModel.jsm:652
    handleResultInner resource:///modules/calendar/CalStorageDatabase.jsm:236
CalStorageDatabase.jsm:250

Expected results:

No errors reported

Component: Untriaged → ICAL.js Integration
OS: Unspecified → macOS
Product: Thunderbird → Calendar
Hardware: Unspecified → Desktop

Daron, there are possibly event entries which can not be parsed because of malformed date or date time data.

Flags: needinfo?(db)

I’m away at the moment but can give you access to one of the problematical calendars when I get home. I’d want to pass those details on privately. Would that help? No other applications I use the calendars with have issues with the calendars.

Flags: needinfo?(db)

Hi Martin we're now back from holiday, can you please contact me directly so I can give you details of one of the problematic calendars so you can investigate?
No other calendar application I have used on the Mac (Apple Calendar, Fantastical, BusyCal) has any issues with reading / writing to the iCloud calendars.

We debugged this a bit. Looks like some alarm date/times contain, for example, 2023-04-24T13:41:55Z which gets transformed into 2023--0-4-T4T:13::4 which is then unsuccessfully parsed. The correct input would be 20230424T134155Z. We're looking further where that data comes from. Of course it's not imported since the parsing fails. In any case, error reporting should be greatly improved since Could not extract integer from ":4" is not helpful.

If we add this code

  set icalString(val) {
    let jcalString;
    if (val.length > 10) {
      if (/-.*-.*:.*:/.test(val)) {
        console.log(`=== Found value ${val}, not processing via ICAL`);
        jcalString = val;
      } else {
        jcalString = ICAL.design.icalendar.value["date-time"].fromICAL(val);
      }
    } else {
      jcalString = ICAL.design.icalendar.value.date.fromICAL(val);
    }
    this.innerObject = ICAL.Time.fromString(jcalString);
  },

here https://searchfox.org/comm-central/rev/f54fce038921a7a7011a68e7ad9c3e2d6691ad17/calendar/base/src/CalDateTime.jsm#196, we see this in the console:

=== Found value 2023-10-09T12:51:27Z, not processing via ICAL

It looks like the alarm is properly imported into the TB Calendar and can also be exported resulting in:

BEGIN:VALARM
ACTION:AUDIO
TRIGGER:-PT5M
ATTACH:Basso
X-MOZ-LASTACK:2023-10-09T12:51:27Z
UID:943F6ECB-41F9-4CED-8DFD-7DF31C54E15A
X-BUSYMAC-DEFAULT-ALARM:TRUE
ACKNOWLEDGED:20231009T125127Z
END:VALARM

Surprising is the X-MOZ-LASTACK:2023-10-09T12:51:27Z. This format occurs 16 times in the calendar matching the number of console messages. Other dates in the exported ICS file have this format X-MOZ-LASTACK:20230822T142704Z.

So somehow two different formats are used for the X-MOZ-LASTACK attribute and one throws the parser off the rails.

console.trace() === Found value 2023-04-24T13:41:55Z, not processing via ICAL 2 CalDateTime.jsm:197:17
    set icalString resource:///modules/CalDateTime.jsm:197
    createDateTime resource:///modules/calendar/calUtils.jsm:33
    set icalComponent resource:///modules/CalAlarm.jsm:559 <<--- this line here
    set icalString resource:///modules/CalAlarm.jsm:363
    CalAlarm resource:///modules/CalAlarm.jsm:38
    getAdditionalDataForItem resource:///modules/calendar/CalStorageItemModel.jsm:973
    handleResultInner resource:///modules/calendar/CalStorageDatabase.jsm:236
    handleResult resource:///modules/calendar/CalStorageDatabase.jsm:230

This is in version 115. Interesting code here:
https://searchfox.org/comm-esr115/source/calendar/base/src/CalAlarm.jsm#556-559

    // Set up the alarm lastack. We can't use valueAsDatetime here since
    // the default for an X-Prop is TEXT and in older versions we didn't set
    // VALUE=DATE-TIME.
    this.lastAck = lastAckProp ? cal.createDateTime(lastAckProp.valueAsIcalString) : null;

The comment suggests some incompatibility with "older versions".

Summary: error when parsing Apple iCloud calendars → Error when parsing Apple iCloud calendars (Error: Could not extract integer from ":3")
See Also: → 1879959, 1294668
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: