pimutils / vdirsyncer

📇 Synchronize calendars and contacts.
https://vdirsyncer.pimutils.org/
Other
1.58k stars 163 forks source link

404s when trying to sync from google cal with start_date and end_date #1007

Open FrederikP opened 2 years ago

FrederikP commented 2 years ago

When I'm using start_date and end_date then vdirsyncer cannot sync and fails with 404 errors. Kind of like google is listing non-existing calendar events when those parameters are supplied. If I'm commenting the fields out, then syncing works. I don't know how to workaround this issue other than just syncing everything.

Config:

[general]
status_path = "./status/"

[pair workcal]
a = "work"
b = "wolke"
collections = [["work", "name@example.com", "arbeit"]]
conflict_resolution = "a wins"

[storage work]
type = "google_calendar"
token_file = "./googleoathtoken"
client_id = "---"
client_secret = "---"
start_date = "datetime.now()"
end_date = "datetime.now() + timedelta(days=365)"
read_only = true

[storage wolke]
type = "caldav"
url = "https://nextcloud.example.com/remote.php/dav"
username = "username"
password = "----"

Log:

error: Unknown error occurred for workcal/work: /caldav/v2/name@example.com/events/idj879l08i1jpn7i5j4qm0g4qs_R20211026T130000@google.com.ics
error: Use `-vdebug` to see the full traceback.
debug:   File "/usr/local/lib/python3.10/site-packages/vdirsyncer/cli/tasks.py", line 71, in sync_collection
debug:     sync.sync(
debug:   File "/usr/local/lib/python3.10/site-packages/vdirsyncer/sync/__init__.py", line 140, in sync
debug:     a_nonempty = a_info.prepare_new_status()
debug:   File "/usr/local/lib/python3.10/site-packages/vdirsyncer/sync/__init__.py", line 61, in prepare_new_status
debug:     for href, item, etag in self.storage.get_multi(prefetch) if prefetch else ():
debug:   File "/usr/local/lib/python3.10/site-packages/vdirsyncer/storage/dav.py", line 505, in get_multi
debug:     raise exceptions.NotFoundError(href)

And a little bit above:

[...]DESCRIPTION:This is an event reminder\nTRIGGER:-P0DT0H10M0S\nEND:VALARM\nEND:VEVENT\nEND:VCALENDAR\n</caldav:calendar-data>\n   </D:prop>\n  </D:propstat>\n </D:response>\n <D:response xmlns:carddav="urn:ietf:params:xml:ns:carddav" xmlns:cm="http://cal.me.com/_namespace/" xmlns:md="urn:mobileme:davservices">\n  <D:href>/caldav/v2/name@example.com/events/idj879l08i1jpn7i5j4qm0g4qs_R20211026T130000@google.com.ics</D:href>\n  <D:status>HTTP/1.1 404 Not Found</D:status>\n </D:response>\n <D:response xmlns:carddav="urn:ietf:params:xml:ns:carddav" xmlns:cm="http://cal.me.com/_namespace/" xmlns:md="urn:mobileme:davservices">\n  <D:href>/caldav/v2/name@example.com/events/hsko8ourfkjtf63bv0cp5qjnds_R20211022T143000@google.com.ics</D:href>\n  <D:status>HTTP/1.1 404 Not Found</D:status>\n </D:response>\n <D:response xmlns:carddav="urn:ietf:params:xml:ns:carddav" xmlns:cm="http://cal.me.com/_namespace/" xmlns:md="urn:mobileme:davservices">\n  <D:href>/caldav/v2/name@example.com/events/hsko8ourfkjtf63bv0cp5qjnds_R20201002T143000@google.com.ics</D:href>\n  <D:status>HTTP/1.1 404 Not Found</D:status>\n </D:response>\n <D:response xmlns:carddav="urn:ietf:params:xml:ns:carddav" xmlns:cm="http://cal.me.com/_namespace/" xmlns:md="urn:mobileme:davservices">\n  <D:href>/caldav/v2/name@example.com/events/hsko8ourfkjtf63bv0cp5qjnds_R20211015T143000@google.com.ics</D:href>\n  <D:status>HTTP/1.1 404 Not Found</D:status>\n </D:response>\n <D:response xmlns:carddav="urn:ietf:params:xml:ns:carddav" xmlns:cm="http://cal.me.com/_namespace/" xmlns:md="urn:mobileme:davservices">\n  <D:href>/caldav/v2/name@example.com/events/hsko8ourfkjtf63bv0cp5qjnds_R20201120T153000@google.com.ics</D:href>\n  <D:status>HTTP/1.1 404 Not Found</D:status>\n </D:response>\n <D:response xmlns:carddav="urn:ietf:params:xml:ns:carddav" xmlns:cm="http://cal.me.com/_namespace/" xmlns:md="urn:mobileme:davservices">\n  <D:href>/caldav/v2/name@example.com/events/hsko8ourfkjtf63bv0cp5qjnds@google.com.ics</D:href>\n  <D:status>HTTP/1.1 404 Not Found</D:status>\n </D:response>\n</D:multistatus>\n
supermarin commented 1 year ago

Is this linked with https://github.com/pimutils/vdirsyncer/issues/760? Seeing the same issue while trying to link an existing fastmail cal.

It looks like any event with @ in it's name will error.

raxod502 commented 1 year ago

I can't seem to figure out how to get a non-404 response from Fastmail CalDAV for events with at-signs in their UIDs. I've submitted a support ticket with Fastmail inquiring about the behavior.

WhyNotHugo commented 1 year ago

I can't seem to figure out how to get a non-404 response from Fastmail CalDAV for events with at-signs in their UIDs. I've submitted a support ticket with Fastmail inquiring about the behavior.

Sounds like an issue in vdirsyncer to be honest, we have some issues with regards to un-encoding UIDs with escaped characters.

This is a separate issue though. I think there is a ticket for it somewhere.

I'll go ahead and make sure I test the new implementation for this specific sitution.

raxod502 commented 1 year ago

I should have posted this follow-up (I haven't had a chance to look into it myself yet), but the Fastmail folks say this is a bug on the vdirsyncer side, and have a convincing argument for why:

image

raxod502 commented 1 year ago

In my testing, https://github.com/pimutils/vdirsyncer/commit/889183ec89ba807177ee7a276d6f9113df09e7ac resolves this issue (I did a bisect after finding the error was gone in the latest revision).

WhyNotHugo commented 1 year ago

That patch was included in 0.19.0 (Dec 2022). Please upgrade

raxod502 commented 1 year ago

Yep, I did so once I realized the issue had been resolved, and the new version works perfectly. Ubuntu 22.04 doesn't ship a recent enough version so I packaged it myself.