pimutils / pimutils/vdirsyncer

A leading space in UID will cause a NotFoundError with Google calendar

Open
#734 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

mod: Google planning type: bug
Dominant language
Python
Stars
1.9k
Forks
185
Avg merge
11h 49m
Merged PRs (30d)
1

Description

vdirsyncer, version 0.16.4

A leading space in the UID will cause a NotFoundError when syncing with Google calendar. Removing the space in the iCalendar file before importing to Google calendar allows vdirsyncer to sync correctly.
The space is also preserved by Google when exported.

BEGIN:VCALENDAR
PRODID:-//WebTIS
VERSION:2.0
CALSCALE:GREGORIAN
METHOD:PUBLISH

BEGIN:VEVENT
DTSTAMP:20180518T160000Z
UID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx@tickets.virgintrainseastcoast.com
DTSTART:20180518T160000Z
DTEND:20180518T170000Z
SUMMARY:Journey Details: 
DESCRIPTION:Booking Reference: 
END:VEVENT

END:VCALENDAR

I think relevant lines from vdirsyncer -vdebug

debug:  <D:response xmlns:carddav="urn:ietf:params:xml:ns:carddav" xmlns:cm="http://cal.me.com/_namespace/" xmlns:md="urn:mobileme:davservices">
debug:   <D:href>/caldav/v2/xxxxxxxx%40gmail.com/events/+479xxxxxxxxxxxxxxxxxxxxxxxxx%40tickets.virgintrainseastcoast.com.ics</D:href>
debug:   <D:propstat>
debug:    <D:status>HTTP/1.1 200 OK</D:status>
debug:    <D:prop>
debug:     <D:getcontenttype>text/calendar; component=vevent</D:getcontenttype>
debug:     <D:getetag>"63616214114"</D:getetag>
debug:    </D:prop>
debug:   </D:propstat>
debug:  </D:response>
debug: Normalized URL from '/caldav/v2/xxxxxxxx%40gmail.com/events/+479xxxxxxxxxxxxxxx%40tickets.virgintrainseastcoast.com.ics' to '/caldav/v2/xxxxxxxx@gmail.com/events/%2B479xxxxxxxxxxxxxxxxx@tickets.virgintrainseastcoast.com.ics'
debug: Unsafe character: '%2B'
debug: Already normalized: '/caldav/v2/xxxxxxxx@gmail.com/events/%2B479xxxxxxxxxxxxxxxx@tickets.virgintrainseastcoast.com.ics'
debug: <D:href>/caldav/v2/xxxxxxxx@gmail.com/events/%2B479xxxxxxxxxxxxx@tickets.virgintrainseastcoast.com.ics</D:href>
debug:  <D:response xmlns:carddav="urn:ietf:params:xml:ns:carddav" xmlns:cm="http://cal.me.com/_namespace/" xmlns:md="urn:mobileme:davservices">
debug:   <D:href>/caldav/v2/xxxxxxxx@gmail.com/events/%2B479xxxxxxxx@tickets.virgintrainseastcoast.com.ics</D:href>
debug:   <D:status>HTTP/1.1 404 Not Found</D:status>
debug:  </D:response>
error: Unknown error occured for calendar_xxxxxxxxx_gmail_com/xxxxxxxx@gmail.com: /caldav/v2/xxxxxxxx@gmail.com/events/%2B4796xxxxxxxxxxxxxx@tickets.virgintrainseastcoast.com.ics
error: Use `-vdebug` to see the full traceback.
debug:   File "/nix/store/a8jyi8rvqdag5zviaxzxb85api600aws-vdirsyncer-0.16.4/lib/python3.6/site-packages/vdirsyncer/cli/tasks.py", line 69, in sync_collection
debug:     partial_sync=pair.partial_sync
debug:   File "/nix/store/a8jyi8rvqdag5zviaxzxb85api600aws-vdirsyncer-0.16.4/lib/python3.6/site-packages/vdirsyncer/sync/__init__.py", line 136, in sync
debug:     b_nonempty = b_info.prepare_new_status()
debug:   File "/nix/store/a8jyi8rvqdag5zviaxzxb85api600aws-vdirsyncer-0.16.4/lib/python3.6/site-packages/vdirsyncer/sync/__init__.py", line 59, in prepare_new_status
debug:     if prefetch else ()):
debug:   File "/nix/store/a8jyi8rvqdag5zviaxzxb85api600aws-vdirsyncer-0.16.4/lib/python3.6/site-packages/vdirsyncer/storage/dav.py", line 516, in get_multi
debug:     raise exceptions.NotFoundError(href)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with storage/dav.py around get_multi(), then follow the URL normalization path shown in the debug output. Reproduce the failure with the supplied iCalendar event containing a leading-space UID; done means syncing that event no longer raises NotFoundError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend, cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.