nextcloud / nextcloud/server

Expand CalDAVRemoveEmptyValue.php to fix additional 'Unsupported VALUE parameter for DTEND property' errors that cause sync issues

Open
#17,554 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

1. to develop enhancement feature: caldav feature: dav good first issue
Dominant language
PHP
Stars
36.9k
Forks
5.2k
Avg merge
2d 3h
Merged PRs (30d)
713

Description

I just squashed a long existing type of error message in my logs, of the form 'Unsupported VALUE parameter for DTEND property'. I tracked this down to incorrect VCARD data created while running Owncloud Calendar 0.8.1.

The following patch to apps/dav/lib/Migration/CalDAVRemoveEmptyValue.php combined with a call to occ maintenance:repair fixes the incorrect VCARD data. This fixed all kinds of sync issues with shared calendars on my installation. Please consider integrating similar logic for other users benefit.

61c61
<               $pattern = 'DTEND;VALUE=;';
---
>               $pattern = ';VALUE=:';
69c69
<                       $data = preg_replace('/' . $pattern . '/', 'DTEND;', $calObject['calendardata']);
---
>                       $data = preg_replace('/' . $pattern . '/', ':', $calObject['calendardata']);

This is an example of the invalid VCARD data (newlines added for legibility):

BEGIN:VCALENDAR\n
VERSION:2.0\n
PRODID:ownCloud Calendar 0.8.1\n
BEGIN:VEVENT\r\n
DTSTAMP:20160212T233814Z\r\n
UID:123@example.org\r\n
SUMMARY:FooEvent\r\n
ORGANIZER:mailto:user@example.org\r\n
STATUS:CONFIRMED\r\n
DTSTART;TZID=Europe/Paris:20151212T140000\r\n
DTEND;VALUE=;TZID=Europe/Paris:20151212T200000\r\n
END:VEVENT\r\n
END:VCALENDAR

example stack trace:

[webdav] Fatal: Sabre\VObject\InvalidDataException: Unsupported VALUE parameter for DTEND property. You supplied "" at <<closure>>

 0. /path/to/nextcloud/3rdparty/sabre/vobject/lib/Parser/MimeDir.php line 454
    Sabre\VObject\Document->createProperty("DTEND", null, {VALUE: "",TZID: "<TIMEZONE>"})
 1. /path/to/nextcloud/3rdparty/sabre/vobject/lib/Parser/MimeDir.php line 234
    Sabre\VObject\Parser\MimeDir->readProperty("DTEND;VALUE=;TZ ... 0")
 2. /path/to/nextcloud/3rdparty/sabre/vobject/lib/Parser/MimeDir.php line 217
    Sabre\VObject\Parser\MimeDir->parseLine("DTEND;VALUE=;TZ ... 0")
 3. /path/to/nextcloud/3rdparty/sabre/vobject/lib/Parser/MimeDir.php line 181
    Sabre\VObject\Parser\MimeDir->parseLine("DTEND;VALUE=;TZ ... 0")
 4. /path/to/nextcloud/3rdparty/sabre/vobject/lib/Parser/MimeDir.php line 89
    Sabre\VObject\Parser\MimeDir->parseDocument()
 5. /path/to/nextcloud/3rdparty/sabre/vobject/lib/Reader.php line 46
    Sabre\VObject\Parser\MimeDir->parse("BEGIN:VCALENDAR ... R", 0)
 6. /path/to/nextcloud/apps/dav/lib/CalDAV/CalendarObject.php line 61
    Sabre\VObject\Reader::read("BEGIN:VCALENDAR ... R")
 7. /path/to/nextcloud/3rdparty/sabre/dav/lib/CalDAV/Plugin.php line 413
    OCA\DAV\CalDAV\CalendarObject->get()
 8. /path/to/nextcloud/3rdparty/sabre/dav/lib/DAV/PropFind.php line 98
    Sabre\CalDAV\Plugin->Sabre\CalDAV\{closure}("*** sensitive parameters replaced ***")
 9. /path/to/nextcloud/3rdparty/sabre/dav/lib/CalDAV/Plugin.php line 420
    Sabre\DAV\PropFind->handle("{urn:ietf:param ... a", Closure {})
10. <<closure>>
    Sabre\CalDAV\Plugin->propFind(Sabre\DAV\PropFind {}, OCA\DAV\CalDAV\CalendarObject {})
11. /path/to/nextcloud/3rdparty/sabre/event/lib/EventEmitterTrait.php line 105
    undefinedundefinedcall_user_func_array([OCA\DAV\CalDAV\Plugin {},"propFind"], [Sabre\DAV\PropF ... }])
12. /path/to/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 1059
    Sabre\Event\EventEmitter->emit("propFind", [Sabre\DAV\PropF ... }])
13. /path/to/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 1025
    Sabre\DAV\Server->getPropertiesByNode(Sabre\DAV\PropFind {}, OCA\DAV\CalDAV\CalendarObject {})
14. /path/to/nextcloud/3rdparty/sabre/dav/lib/CalDAV/Plugin.php line 447
    Sabre\DAV\Server->getPropertiesForMultiplePaths(["calendars/<USER> ... "], ["{DAV:}getetag" ... "])
15. /path/to/nextcloud/3rdparty/sabre/dav/lib/CalDAV/Plugin.php line 246
    Sabre\CalDAV\Plugin->calendarMultiGetReport(Sabre\CalDAV\Xml ... "})
16. <<closure>>
    Sabre\CalDAV\Plugin->report("{urn:ietf:param ... t", Sabre\CalDAV\Xml ... "}, "calendars/<USER> ... n")
17. /path/to/nextcloud/3rdparty/sabre/event/lib/EventEmitterTrait.php line 105
    undefinedundefinedcall_user_func_array([OCA\DAV\CalDAV\Plugin {},"report"], ["{urn:ietf:para ... "])
18. /path/to/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php line 718
    Sabre\Event\EventEmitter->emit("report", ["{urn:ietf:para ... "])
19. <<closure>>
    Sabre\DAV\CorePlugin->httpReport(Sabre\HTTP\Reque ... "}, Sabre\HTTP\Response {})
20. /path/to/nextcloud/3rdparty/sabre/event/lib/EventEmitterTrait.php line 105
    undefinedundefinedcall_user_func_array([Sabre\DAV\CorePlugin {},"httpReport"], [Sabre\HTTP\Requ ... }])
21. /path/to/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 479
    Sabre\Event\EventEmitter->emit("method:REPORT", [Sabre\HTTP\Requ ... }])
22. /path/to/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 254
    Sabre\DAV\Server->invokeMethod(Sabre\HTTP\Reque ... "}, Sabre\HTTP\Response {})
23. /path/to/nextcloud/apps/dav/lib/Server.php line 316
    Sabre\DAV\Server->exec()
24. /path/to/nextcloud/apps/dav/appinfo/v2/remote.php line 35
    OCA\DAV\Server->exec()
25. /path/to/nextcloud/remote.php line 163
    undefinedundefinedrequire_once("/path/to/nextcl ... p")

REPORT /nextcloud/remote.php/dav/calendars/<USER>/<CALENDAR>/
from <IP> by <USER> at <TIMESTAMP>

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with apps/dav/lib/Migration/CalDAVRemoveEmptyValue.php and review the existing repair logic alongside the malformed VCALENDAR example. Run occ maintenance:repair against affected data, then verify that empty VALUE parameters such as DTEND;VALUE=; are corrected and calendar synchronization no longer produces the reported DTEND error.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.