etesync / etesync-dav

This is a CalDAV and CardDAV adapter for EteSync
https://www.etesync.com
GNU General Public License v3.0
290 stars 47 forks source link

"UNIQUE constraint failed" when restoring deleted ical-items with their old UID #187

Open frainz-de opened 3 years ago

frainz-de commented 3 years ago

Steps to reproduce:

[pair etesync]
a = "etesync_local"
b = "etesync_dav"
collections = [["etesync-calendar", "etesync-calendar", "<collection-ID>"]]

[storage etesync_local]
type = "filesystem"
path = "/path/to/calendar/directory/"
fileext = ".ics"

[storage etesync_dav]
type = "caldav"
url = "http://localhost:37358/<username>/"
username = "<username>"
password = "<DAV password>"

vdirsyncer gives the following error:

error: Unknown error occurred for etesync/etesync-calendar: 500 Server Error: Internal Server Error for url: http://localhost:37358/<username>/<collection>/<item>.ics
error: Use `-vdebug` to see the full traceback.

the dav-bridge gives the following error:

[2020-12-02 13:31:46 +0100] [1666067/Thread-606] [ERROR] An exception occurred during PUT request on '/<username>/<collection>/<item>.ics': UNIQUE constraint failed: itementity.collection_id, itementity.uid

I have attached a file which triggers this behaviour. Just remove the txt extension before using it. 5e046c10-505b-4ce4-83e4-226393ebb537.1548086869446.ics.txt

tasn commented 3 years ago

Sorry for the slow reply and thanks for the report. I wonder what's going on, is this an event with the same internal UUID as another event?

frainz-de commented 3 years ago

No, it's restoring a deleted event via vdirsyncer. So I guess, for etesync it looks like a new event with the same UID.

tasn commented 3 years ago

I just reviewed the code again and it looks fine, could you please make it crash with -D so we get the full backtrace?