Closed Bug 1716745 Opened 3 years ago Closed 4 months ago

Failure to add event to CalDAV calendar when UID of ICS event contains special characters - "/" etc.

Categories

(Calendar :: Provider: CalDAV, defect)

Thunderbird 78
defect

Tracking

(thunderbird_esr128 fixed, thunderbird129 fixed)

RESOLVED FIXED
129 Branch
Tracking Status
thunderbird_esr128 --- fixed
thunderbird129 --- fixed

People

(Reporter: antonin, Assigned: antonin)

References

Details

Attachments

(3 files)

Attached file event_with_uri_as_uid.ics —

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0

Steps to reproduce:

  1. Subscribe to a CalDAV calendar with Thunderbird (I use Baikal 0.8.0).
  2. Open the following ICS file (produced by timeanddate.com) with Thunderbird and attempt to add the event to your CalDAV calendar:
    https://pintoch.ulminfo.fr/f43036d480/event_with_uri_as_uid.ics (also attached in this bug report)

Actual results:

The event is not added to the calendar, with no error message.
(If the ICS file was received as an email attachment and I tried to add it by clicking the "Add" button next in the "This message contains an event" banner, then I get the error message "Processing message failed. Status: 80004005." which is really not informative at all)

Expected results:

First, better error reporting is need. I would expect something like "This event could not be added to the calendar "My calendar". The server responded with 404 error, Calendar object not found."

Then, I would of course expect the event to actually be added to the calendar. The reason why this fails is that the ICS file contains a URL in the "UID" field, and Thunderbird constructs the CalDAV URL for the event by including this UID in the URL without sufficient escaping or sanitization:
https://my.baikal.instance.com/cal.php/calendars/my_calendar/default/http%3A//www.timeanddate.com/worldclock/fixedtime.html%3Fiso%3D20210720T1400%26msg%3DReconciliation%20CG%20July%20Meeting.ics

I believe the "/" character should be escaped as well.

If I open the ICS file with a text editor and replace the UID by something alphanumeric, Thunderbird successfully imports the event.

Component: Untriaged → Provider: CalDAV
Product: Thunderbird → Calendar
Version: 78 → Thunderbird 78

According to https://bugzilla.mozilla.org/show_bug.cgi?id=1663592, the "@" character also seems to cause issues.

Unfortunately I could not build and test this (setting up the build environment took me hours and failed at because llvm-objdump could not be found), but I think this gives an idea of the sort of fix I would expect here.

See Also: → 1663592
Summary: Failure to add event to CalDAV calendar when UID of ICS event contains special characters → Failure to add event to CalDAV calendar when UID of ICS event contains special characters - "/" etc.

I encountered this when attempting to import an ICS event file to Nextcloud CalDAV calendar. Replacing "/" in UID with e.g. "-" allowed importing the event. Tested this against Nextcloud 29.0.2 with newest Thunderbird Beta 128.0b5 (64-bit).

Nextcloud responds with:

<?xml version="1.0" encoding="utf-8"?>
<d:error xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns">
  <s:exception>Sabre\DAV\Exception\NotFound</s:exception>
  <s:message>Calendar object not found</s:message>
</d:error>

When Thunderbird tries to PUT to https://MY-DOMAIN/remote.php/dav/calendars/jhakonen/oma-kalenteri/b3fb70d5aa23/TRTX2GHM%40ajas.fi.ics with UID-line being UID:b3fb70d5aa23/TRTX2GHM@ajas.fi.

Makes sure the PUT request has a valid URL to avoid import errors.

Assignee: nobody → antonin
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Target Milestone: --- → 129 Branch

Pushed by martin@humanoids.be:
https://hg.mozilla.org/comm-central/rev/5d711ffba2a7
Fix CalDav import of ICS events with special characters in the UID. r=darktrojan

Status: ASSIGNED → RESOLVED
Closed: 4 months ago
Resolution: --- → FIXED
Duplicate of this bug: 1663592
See Also: 1663592

Comment on attachment 9410728 [details]
Bug 1716745 - Fix CalDav import of ICS events with special characters in the UID. r=darktrojan

[Approval Request Comment]
User impact if declined: per bug summary
Testing completed (on c-c, etc.): c-c, beta
Risk to taking this patch (and alternatives if risky): pretty safe

Attachment #9410728 - Flags: approval-comm-esr128?

Comment on attachment 9410728 [details]
Bug 1716745 - Fix CalDav import of ICS events with special characters in the UID. r=darktrojan

[Triage Comment]
Approved for esr128

Attachment #9410728 - Flags: approval-comm-esr128? → approval-comm-esr128+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: