summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Wurst <ChristophWurst@users.noreply.github.com>2021-06-23 21:34:34 +0200
committerGitHub <noreply@github.com>2021-06-23 21:34:34 +0200
commitd87248fe40fcca57fdffd310abce0e26f3d7ed96 (patch)
tree673038cb5d87976b91d7b005c04ab4c7ea3a9337
parenta52ed8e6771255f197c0178d8b22ec0f1e373649 (diff)
parent3a690b1cb59c31f37f91eea73e157c3bb26b6cef (diff)
downloadnextcloud-server-d87248fe40fcca57fdffd310abce0e26f3d7ed96.tar.gz
nextcloud-server-d87248fe40fcca57fdffd310abce0e26f3d7ed96.zip
Merge pull request #27632 from nextcloud/chore/caldav-trashbin-iso-timestamps
Use ISO8601 timestamps for the CalDAV trashbin
-rw-r--r--apps/dav/lib/CalDAV/Calendar.php10
-rw-r--r--apps/dav/lib/CalDAV/Trashbin/Plugin.php11
2 files changed, 20 insertions, 1 deletions
diff --git a/apps/dav/lib/CalDAV/Calendar.php b/apps/dav/lib/CalDAV/Calendar.php
index df4d6d4a3fb..fa29fc8d588 100644
--- a/apps/dav/lib/CalDAV/Calendar.php
+++ b/apps/dav/lib/CalDAV/Calendar.php
@@ -28,6 +28,9 @@
*/
namespace OCA\DAV\CalDAV;
+use DateTimeImmutable;
+use DateTimeInterface;
+use OCA\DAV\CalDAV\Trashbin\Plugin as TrashbinPlugin;
use OCA\DAV\DAV\Sharing\IShareable;
use OCA\DAV\Exception\UnsupportedLimitOnInitialSyncException;
use OCP\IConfig;
@@ -63,6 +66,13 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IRestorable, IShareable
* @param IConfig $config
*/
public function __construct(BackendInterface $caldavBackend, $calendarInfo, IL10N $l10n, IConfig $config) {
+ // Convert deletion date to ISO8601 string
+ if (isset($calendarInfo[TrashbinPlugin::PROPERTY_DELETED_AT])) {
+ $calendarInfo[TrashbinPlugin::PROPERTY_DELETED_AT] = (new DateTimeImmutable())
+ ->setTimestamp($calendarInfo[TrashbinPlugin::PROPERTY_DELETED_AT])
+ ->format(DateTimeInterface::ATOM);
+ }
+
parent::__construct($caldavBackend, $calendarInfo);
if ($this->getName() === BirthdayService::BIRTHDAY_CALENDAR_URI) {
diff --git a/apps/dav/lib/CalDAV/Trashbin/Plugin.php b/apps/dav/lib/CalDAV/Trashbin/Plugin.php
index a4dff69ec77..58ff76beca1 100644
--- a/apps/dav/lib/CalDAV/Trashbin/Plugin.php
+++ b/apps/dav/lib/CalDAV/Trashbin/Plugin.php
@@ -26,6 +26,8 @@ declare(strict_types=1);
namespace OCA\DAV\CalDAV\Trashbin;
use Closure;
+use DateTimeImmutable;
+use DateTimeInterface;
use OCA\DAV\CalDAV\Calendar;
use OCA\DAV\CalDAV\RetentionService;
use OCP\IRequest;
@@ -101,7 +103,14 @@ class Plugin extends ServerPlugin {
INode $node): void {
if ($node instanceof DeletedCalendarObject) {
$propFind->handle(self::PROPERTY_DELETED_AT, function () use ($node) {
- return $node->getDeletedAt();
+ $ts = $node->getDeletedAt();
+ if ($ts === null) {
+ return null;
+ }
+
+ return (new DateTimeImmutable())
+ ->setTimestamp($ts)
+ ->format(DateTimeInterface::ATOM);
});
$propFind->handle(self::PROPERTY_CALENDAR_URI, function () use ($node) {
return $node->getCalendarUri();