Open Bug 2072470 Opened 2 months ago Updated 3 hours ago

CalDAV: Accepting invitations with "@" in the event UID can prevent the iTIP reply from being sent

Categories

(Calendar :: E-mail based Scheduling (iTIP/iMIP), defect)

Thunderbird 156
defect

Tracking

(Not tracked)

ASSIGNED

People

(Reporter: alex.stan.tietz, Assigned: huntsdabibil)

References

Details

Attachments

(1 external file)

When accepting a calendar invitation in Thunderbird and storing it in a CalDAV calendar, the event can be stored successfully while Thunderbird does not send the expected iTIP reply to the organizer.

I reproduced this with Google Calendar as the CalDAV provider. The issue occurs when the event UID contains @: Thunderbird replaces @ with _ when generating the new CalDAV resource name, while Google Calendar subsequently exposes the created resource using %40.

Steps to reproduce

  1. Configure a Google Calendar via CalDAV in Thunderbird.

  2. Enable client-side email scheduling for the calendar.

  3. Receive a calendar invitation whose VEVENT UID contains @, for example:

    example-event-uid@example.com

  4. Accept the invitation and store it in the configured CalDAV calendar.

Actual result

Thunderbird successfully PUTs the accepted event to the CalDAV server, but no iTIP METHOD:REPLY email is sent to the organizer.

The issue appears to be caused by the generated CalDAV resource path.

CalDavCalendar.sys.mjs currently defines:

var FORBIDDEN_PATH_CHARACTERS = /[^a-zA-Z0-9_\-\.]/g;

and getItemLocationPath() generates the resource filename with:

return aItem.id.replaceAll(FORBIDDEN_PATH_CHARACTERS, "_") + ".ics";

Therefore, a UID such as:

example-event-uid@example.com

becomes:

example-event-uid_example.com.ics

Thunderbird PUTs the new event using this resource path.

Google Calendar accepts the PUT, but the resource is subsequently returned by Google Calendar under:

example-event-uid%40example.com.ics

Thunderbird subsequently performs its post-PUT calendar-multiget using:

example-event-uid_example.com.ics

Google responds with:

HTTP/1.1 404 Not Found

Example before the change:

PUT .../example-event-uid_example.com.ics
...
REPORT calendar-multiget .../example-event-uid_example.com.ics
HTTP/1.1 404 Not Found
CalDAV: skipping unfound deleted item

The failed post-PUT re-fetch appears to prevent the normal item-add completion path from reaching the point where the attendee iTIP reply is sent.

Expected result

After the event has been successfully stored in the CalDAV calendar, Thunderbird should successfully re-fetch the newly created resource and send the attendee response to the organizer:

METHOD:REPLY
PARTSTAT=ACCEPTED

Root cause / possible fix

Allow @ to remain in newly generated CalDAV resource names:

-var FORBIDDEN_PATH_CHARACTERS = /[^a-zA-Z0-9_\-\.]/g;
+var FORBIDDEN_PATH_CHARACTERS = /[^a-zA-Z0-9_@\-\.]/g;

Thunderbird's URI construction subsequently percent-encodes the path, so:

example-event-uid@example.com.ics

becomes:

example-event-uid%40example.com.ics

Verification

I tested this change with a completely new calendar invitation using a new UID and SEQUENCE:0, storing the accepted event in Google Calendar via CalDAV.

With only the change above applied, and without any changes to calItipUtils.sys.mjs, Thunderbird directly used:

.../example-event-uid%40example.com.ics

for both the initial PUT and the subsequent calendar-multiget.

The multiget then returned:

HTTP/1.1 200 OK

The normal Thunderbird iTIP flow continued and generated:

METHOD:REPLY
PARTSTAT=ACCEPTED

The SMTP message was subsequently sent successfully.

Before:

PUT    .../example-event-uid_example.com.ics
REPORT .../example-event-uid_example.com.ics
-> 404 Not Found
-> no attendee reply

After:

PUT    .../example-event-uid%40example.com.ics
REPORT .../example-event-uid%40example.com.ics
-> 200 OK
-> METHOD:REPLY generated
-> attendee reply sent successfully

Additional information

@ is permitted in a URI path segment according to RFC 3986. Thunderbird already percent-encodes the resulting path when constructing the request URI.

The externally visible symptom may be related to Bug 1738889 (acceptance is stored but no reply is sent), although the reproducible root cause described here is specifically the CalDAV resource-path mismatch after creating an item whose UID contains @.

This appears related to Bug 1439215, which describes the same user-visible symptom for Google invitations with @google.com UIDs. However, that bug identified double-encoding (%40 becoming %2540) as the cause.

The issue reproduced here is different: in current Thunderbird, @ is replaced with _ when generating the new CalDAV resource name, causing the post-PUT re-fetch to use a different path from the one subsequently exposed by Google Calendar.

Bug 1716745 also addressed special characters in CalDAV UIDs, but this issue remains reproducible in Thunderbird 156.

Component: Provider: CalDAV → E-mail based Scheduling (iTIP/iMIP)
See Also: → 1738889, 1439215

Confirming this on Thunderbird 153.7.0 (Windows 11), Google Calendar via native
CalDAV (secondary calendar, ...%40group.calendar.google.com), offline cache
enabled, "Prefer client-side email scheduling" checked, email identity set to a
non-Google address. Same log pattern: PUT to <uid>_google.com.ics, multiget of
that href -> "skipping unfound deleted item", no iTIP REPLY sent, nothing in
Sent/Outbox. Happens for every new invitation.

One additional observation, relevant to anyone looking for a workaround:
accepting "Tentative" first (item gets added, no reply) and then "Accept" also
does not send a reply. The modify PUT with PARTSTAT=ACCEPTED succeeds and the
re-fetch uses the correct %40 href, but Google ignores PARTSTAT changes for a
non-Google attendee on an existing event, so the re-fetched item is still
TENTATIVE. checkAndSend() is fed the server version, sees no PARTSTAT change
and sends nothing. So with Google CalDAV there is currently no way to get a
reply sent; the fix proposed here (allowing @ in new resource names) is needed.

Keep @ in UID-derived filenames so URL encoding produces the same resource
name Google Calendar returns after creating an item. This follows the
filename change proposed in the bug report.

Report a per-resource 404 to the waiting operation when it reads an item
back after a write. Background sync still handles missing resources as
deletions.

Exercise email Add and multi-item ICS import against the CalDAV fixture,
as well as a write whose follow-up read receives a per-resource 404.

Verify the invitation acceptance path using a CalDAV fixture that names
resources like Google and an SMTP test server that captures the iTIP reply.

Attachment #9690070 - Attachment description: WIP: Bug 2072470 - Preserve @ in CalDAV resource names and surface missing read-backs. → Bug 2072470 - Preserve @ in CalDAV resource names and surface missing read-backs.

I confirmed the same filename mismatch with Google Calendar. After installing the patched Daily 163 build on Windows, I verified that both the email Add button and .ics import completed and that Google returned the saved events.

I also tested accepting an invitation with a local CalDAV and SMTP setup. Thunderbird sent the organizer a METHOD:REPLY with PARTSTAT=ACCEPTED after reading the event back from CalDAV. The patch and regression tests are in D345898.

Assignee: nobody → huntsdabibil
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: