There is a bug when moving an contact with birthdate to another address book.
I found the cause and described it in https://github.com/nextcloud/server/issues/20492#issuecomment-663207488
The problem is as follows:
- When a vcard changes, “onCardChanged” is called on the BirthdayService, so that the birthdate can be stored in the calendar.
BirthdayService::updateCalendarchecks if the calendar entry already exists with
CalDavBackEnd::getCalendarObject($calendarId, $objectUri). That one says “no, does not exist”, because the
$objectUriis at the new calendar.
BirthdayService::updateCalendartries to create a new calendar entry with
CalDavBackEnd::createCalendarObject($calendarId, $objectUri, $calendarData->serialize()). That fails, because
createCalendarObjectfirst checks if an calendar entry with that UID (not uri!) already exists, and throws an exception here.
I am not sure what the right solution would be here.
Step 2 could use the UID to check if the calendar entry exists instead of the URI, but that may have side effects I do not know of.
What do the nextcloud devs think how that should be solved?