[TikiWiki-commits] [Git][tikiwiki/tiki][30.x] [FIX] duplicate event when changing event calendar and save

"Victor Emanouilov \(@kroky\) via TikiWiki-cvs" <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <6a14374621341_3813c6f1981028a5@gitlab-sidekiq-low-urgency-cpu-bound-v2-d7f87744c-mns7h.mail>

Victor Emanouilov pushed to branch 30.x at Tiki Wiki CMS Groupware / Tiki


Commits:
50142197 by Victor Emanouilov at 2026-05-25T14:49:21+03:00
[FIX] duplicate event when changing event calendar and save

- - - - -


1 changed file:

- lib/core/Tiki/SabreDav/CalDAVBackend.php


Changes:

=====================================
lib/core/Tiki/SabreDav/CalDAVBackend.php
=====================================
@@ -589,6 +589,18 @@ class CalDAVBackend extends CalDAV\Backend\AbstractBackend implements
         if (! is_array($calendarId)) {
             throw new \InvalidArgumentException('The value passed to $calendarId is expected to be an array with a calendarId and an instanceId');
         }
+
+        // changing calendars makes caldav server not able to find the event, so it
+        // tries to recreate it (thus duplicate). Detect this here and force update.
+        try {
+            $existing = $this->mapCalendarObjectUriToItem($objectUri);
+            if ($existing) {
+                return $this->updateCalendarObject($calendarId, $objectUri, $calendarData);
+            }
+        } catch (DAV\Exception\NotFound $e) {
+            // URI doesn't map to any existing item => proceed with creation
+        }
+
         list($calendarId, $instanceId) = $calendarId;
 
         $this->ensureCalendarAccess($calendarId, $instanceId, null, 'add_events', 'write');



View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/5014219798953aadd569eefc0dfd19d0a3ad44e6

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/5014219798953aadd569eefc0dfd19d0a3ad44e6
You're receiving this email because of your account on gitlab.com. Manage all notifications: https://gitlab.com/-/profile/notifications | Help: https://gitlab.com/help

_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.