diff --git a/lib/kolab_sync_data.php b/lib/kolab_sync_data.php --- a/lib/kolab_sync_data.php +++ b/lib/kolab_sync_data.php @@ -490,7 +490,23 @@ */ public function createEntry($folderId, Syncroton_Model_IEntry $entry) { - $entry = $this->toKolab($entry, $folderId); + // If we don't have an existing event (not a modification) we nevertheless check for conflicts. + // This is necessary so we don't overwrite the server-side copy in case the client did not have it available + // when generating an Add command. + $existing = null; + try { + $foldername = $this->getFolderName($folderId); + $folder = $this->getFolderObject($foldername); + $existing = $folder->get_object($entry->uID); + + if ($existing) { + $this->logger->debug('Found and existing entry for UID: ' . $entry->uID); + } + } catch (Exception $e) { + // uID is not available on exceptions, so we guard for that and silently ignore. + } + + $entry = $this->toKolab($entry, $folderId, $existing); $entry = $this->createObject($folderId, $entry); if (empty($entry)) {