Page MenuHomePhorge

D5691.1775247013.diff
No OneTemporary

Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None

D5691.1775247013.diff

diff --git a/src/app/Backends/DAV/Vevent.php b/src/app/Backends/DAV/Vevent.php
--- a/src/app/Backends/DAV/Vevent.php
+++ b/src/app/Backends/DAV/Vevent.php
@@ -308,6 +308,10 @@
foreach ($this->vobject->getComponents() as $component) {
if ($component->name == $selfType) {
+ // DTEND MUST be later than DTSTART (RFC5545 3.8.2.2)
+ if ($component->DTSTART->getDateTime() == $component->DTEND->getDateTime()) {
+ unset($component->DTEND);
+ }
if (empty($master) && empty($component->{'RECURRENCE-ID'})) {
$master = $component;
} elseif ($this->uid && $this->uid == $component->UID && !empty($component->{'RECURRENCE-ID'})) {
diff --git a/src/tests/Unit/Backends/DAV/VeventTest.php b/src/tests/Unit/Backends/DAV/VeventTest.php
--- a/src/tests/Unit/Backends/DAV/VeventTest.php
+++ b/src/tests/Unit/Backends/DAV/VeventTest.php
@@ -100,4 +100,49 @@
// TODO: Test all supported properties in detail
}
+
+ /**
+ * Test Vevent::repair()
+ */
+ public function testDropEqualDtend(): void
+ {
+ $uid = 'A8CCF090C66A7D4D805A8B897AE75AFD-8FE68B2E68E1B348';
+ $ical = <<<XML
+ <?xml version="1.0" encoding="utf-8"?>
+ <d:multistatus xmlns:d="DAV:" xmlns:c="urn:ietf:params:xml:ns:caldav">
+ <d:response>
+ <d:href>/dav/calendars/user/test@test.com/Default/{$uid}.ics</d:href>
+ <d:propstat>
+ <d:prop>
+ <d:getetag>"d27382e0b401384becb0d5b157d6b73a2c2084a2"</d:getetag>
+ <c:calendar-data><![CDATA[BEGIN:VCALENDAR
+ VERSION:2.0
+ PRODID:-//Test//EN
+ METHOD:PUBLISH
+ BEGIN:VEVENT
+ UID:{$uid}
+ DTSTAMP:20221016T103238Z
+ DTSTART;VALUE=DATE:20221013
+ DTEND;VALUE=DATE:20221013
+ SEQUENCE:1
+ SUMMARY:My summary
+ DESCRIPTION:desc
+ ORGANIZER:mailto:organizer@test.com
+ END:VEVENT
+ END:VCALENDAR
+ ]]></c:calendar-data>
+ </d:prop>
+ <d:status>HTTP/1.1 200 OK</d:status>
+ </d:propstat>
+ </d:response>
+ </d:multistatus>
+ XML;
+
+ $doc = new \DOMDocument('1.0', 'UTF-8');
+ $doc->loadXML($ical);
+ $event = Vevent::fromDomElement($doc->getElementsByTagName('response')->item(0));
+ $event->repair();
+
+ $this->assertStringNotContainsString($event, "DTEND");
+ }
}

File Metadata

Mime Type
text/plain
Expires
Fri, Apr 3, 8:10 PM (1 d, 2 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18826261
Default Alt Text
D5691.1775247013.diff (2 KB)

Event Timeline