diff options
author | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2023-05-17 13:07:43 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-17 13:07:43 +0200 |
commit | d52917c9ce32507957505e47a09905a2d0a587a8 (patch) | |
tree | 3886a44ed541c311d1d3a3353201ed4a424a528f /apps | |
parent | bd9f1e18bfb8e6404934a7a9679b01d34c00bb5c (diff) | |
parent | 01ff7d1b4635b8c0a4eb408abc984932fe979240 (diff) | |
download | nextcloud-server-d52917c9ce32507957505e47a09905a2d0a587a8.tar.gz nextcloud-server-d52917c9ce32507957505e47a09905a2d0a587a8.zip |
Merge pull request #37569 from nextcloud/backport/34375/stable25
[stable25] fix(dav) Handle Calendar trashbin UID conflicts by removing the deleted calendar object
Diffstat (limited to 'apps')
-rw-r--r-- | apps/dav/lib/CalDAV/CalDavBackend.php | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/apps/dav/lib/CalDAV/CalDavBackend.php b/apps/dav/lib/CalDAV/CalDavBackend.php index 709f625afb3..b38858976ff 100644 --- a/apps/dav/lib/CalDAV/CalDavBackend.php +++ b/apps/dav/lib/CalDAV/CalDavBackend.php @@ -1236,17 +1236,19 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription } // For a more specific error message we also try to explicitly look up the UID but as a deleted entry $qbDel = $this->db->getQueryBuilder(); - $qbDel->select($qb->func()->count('*')) + $qbDel->select('*') ->from('calendarobjects') ->where($qbDel->expr()->eq('calendarid', $qbDel->createNamedParameter($calendarId))) ->andWhere($qbDel->expr()->eq('uid', $qbDel->createNamedParameter($extraData['uid']))) ->andWhere($qbDel->expr()->eq('calendartype', $qbDel->createNamedParameter($calendarType))) ->andWhere($qbDel->expr()->isNotNull('deleted_at')); $result = $qbDel->executeQuery(); - $count = (int) $result->fetchOne(); + $found = $result->fetch(); $result->closeCursor(); - if ($count !== 0) { - throw new BadRequest('Deleted calendar object with uid already exists in this calendar collection.'); + if ($found !== false) { + // the object existed previously but has been deleted + // remove the trashbin entry and continue as if it was a new object + $this->deleteCalendarObject($calendarId, $found['uri']); } $query = $this->db->getQueryBuilder(); |