diff --git a/3rdparty b/3rdparty index ec0e643aab90b..37a4d20db5cad 160000 --- a/3rdparty +++ b/3rdparty @@ -1 +1 @@ -Subproject commit ec0e643aab90b8366fe1267b7068ed6e2b95532c +Subproject commit 37a4d20db5cad99082d636bab63dc1c8f4c481a6 diff --git a/apps/dav/lib/Connector/Sabre/Directory.php b/apps/dav/lib/Connector/Sabre/Directory.php index 1634c512804b3..6bec57c50fbb3 100644 --- a/apps/dav/lib/Connector/Sabre/Directory.php +++ b/apps/dav/lib/Connector/Sabre/Directory.php @@ -472,7 +472,12 @@ public function moveInto($targetName, $fullSourcePath, INode $sourceNode) { } #[\Override] - public function copyInto($targetName, $sourcePath, INode $sourceNode) { + public function copyInto($targetName, $sourcePath, INode $sourceNode, int $depth): bool { + if ($sourceNode instanceof Directory && $depth !== \Sabre\DAV\Server::DEPTH_INFINITY) { + // Fall back to sabre default copyNode() implementation + return false; + } + if ($sourceNode instanceof File || $sourceNode instanceof Directory) { try { $destinationPath = $this->getPath() . '/' . $targetName; diff --git a/apps/dav/lib/Connector/Sabre/ObjectTree.php b/apps/dav/lib/Connector/Sabre/ObjectTree.php index 0feb7032b8507..96121a1450f4b 100644 --- a/apps/dav/lib/Connector/Sabre/ObjectTree.php +++ b/apps/dav/lib/Connector/Sabre/ObjectTree.php @@ -21,18 +21,12 @@ use OCP\Files\StorageInvalidException; use OCP\Files\StorageNotAvailableException; use OCP\Lock\LockedException; +use Sabre\DAV\INode; +use Sabre\DAV\Server; class ObjectTree extends CachingTree { - - /** - * @var View - */ - protected $fileView; - - /** - * @var IMountManager - */ - protected $mountManager; + protected View $fileView; + protected IMountManager $mountManager; /** * Creates the object @@ -55,14 +49,13 @@ public function init(\Sabre\DAV\INode $rootNode, View $view, IMountManager $moun * Returns the INode object for the requested path * * @param string $path - * @return \Sabre\DAV\INode * @throws InvalidPath * @throws \Sabre\DAV\Exception\Locked * @throws \Sabre\DAV\Exception\NotFound * @throws \Sabre\DAV\Exception\ServiceUnavailable */ #[\Override] - public function getNodeForPath($path) { + public function getNodeForPath($path): INode { if (!$this->fileView) { throw new \Sabre\DAV\Exception\ServiceUnavailable('filesystem not setup'); } @@ -154,7 +147,7 @@ public function getNodeForPath($path) { * @return void */ #[\Override] - public function copy($sourcePath, $destinationPath) { + public function copy($sourcePath, $destinationPath, int $depth = Server::DEPTH_INFINITY): void { if (!$this->fileView) { throw new \Sabre\DAV\Exception\ServiceUnavailable('filesystem not setup'); } @@ -170,7 +163,13 @@ public function copy($sourcePath, $destinationPath) { } // this will trigger existence check - $this->getNodeForPath($sourcePath); + $sourceNode = $this->getNodeForPath($sourcePath); + + if ($sourceNode instanceof Directory && $depth !== Server::DEPTH_INFINITY) { + // Fallback to sabre slow default implementation with $depth support. + parent::copy($sourcePath, $destinationPath, $depth); + return; + } [$destinationDir, $destinationName] = \Sabre\Uri\split($destinationPath); try { diff --git a/apps/dav/lib/ExampleContentFiles/exampleContact.vcf b/apps/dav/lib/ExampleContentFiles/exampleContact.vcf index c58c949d0db6c..95c3310052d0c 100644 --- a/apps/dav/lib/ExampleContentFiles/exampleContact.vcf +++ b/apps/dav/lib/ExampleContentFiles/exampleContact.vcf @@ -1,6 +1,6 @@ BEGIN:VCARD VERSION:3.0 -PRODID:-//Sabre//Sabre VObject 4.5.6//EN +PRODID:-//Sabre//Sabre VObject 4.6.1//EN UID:cffff367-4580-4e01-8b6d-f91e95ce7e92 FN:Leon Green ADR;TYPE=HOME:;;123 Street Street;City;State;;Country diff --git a/apps/dav/tests/unit/test_fixtures/example-event-default-expected.ics b/apps/dav/tests/unit/test_fixtures/example-event-default-expected.ics index 09606ca5ee4d9..4d523f6d64b67 100644 --- a/apps/dav/tests/unit/test_fixtures/example-event-default-expected.ics +++ b/apps/dav/tests/unit/test_fixtures/example-event-default-expected.ics @@ -1,6 +1,6 @@ BEGIN:VCALENDAR VERSION:2.0 -PRODID:-//Sabre//Sabre VObject 4.5.6//EN +PRODID:-//Sabre//Sabre VObject 4.6.1//EN CALSCALE:GREGORIAN BEGIN:VEVENT UID:RANDOM-UID diff --git a/tests/data/ics/event-builder-complete.ics b/tests/data/ics/event-builder-complete.ics index 65fe8e6cf1328..29d5398b29cb7 100644 --- a/tests/data/ics/event-builder-complete.ics +++ b/tests/data/ics/event-builder-complete.ics @@ -1,6 +1,6 @@ BEGIN:VCALENDAR VERSION:2.0 -PRODID:-//Sabre//Sabre VObject 4.5.6//EN +PRODID:-//Sabre//Sabre VObject 4.6.1//EN CALSCALE:GREGORIAN BEGIN:VEVENT UID:event-uid-123 diff --git a/tests/data/ics/event-builder-without-attendees.ics b/tests/data/ics/event-builder-without-attendees.ics index fad48caa3a9e8..1823117a2b43c 100644 --- a/tests/data/ics/event-builder-without-attendees.ics +++ b/tests/data/ics/event-builder-without-attendees.ics @@ -1,6 +1,6 @@ BEGIN:VCALENDAR VERSION:2.0 -PRODID:-//Sabre//Sabre VObject 4.5.6//EN +PRODID:-//Sabre//Sabre VObject 4.6.1//EN CALSCALE:GREGORIAN BEGIN:VEVENT UID:event-uid-123 diff --git a/tests/data/ics/free-busy-request.ics b/tests/data/ics/free-busy-request.ics index dd01d35b67131..c45f94bb01c27 100644 --- a/tests/data/ics/free-busy-request.ics +++ b/tests/data/ics/free-busy-request.ics @@ -1,6 +1,6 @@ BEGIN:VCALENDAR VERSION:2.0 -PRODID:-//Sabre//Sabre VObject 4.5.6//EN +PRODID:-//Sabre//Sabre VObject 4.6.1//EN CALSCALE:GREGORIAN METHOD:REQUEST BEGIN:VFREEBUSY diff --git a/tests/lib/Calendar/ManagerTest.php b/tests/lib/Calendar/ManagerTest.php index ce7ce113ce8bd..007a492e4bdf2 100644 --- a/tests/lib/Calendar/ManagerTest.php +++ b/tests/lib/Calendar/ManagerTest.php @@ -981,7 +981,7 @@ private function getFreeBusyResponse(): string { 2.0;Success BEGIN:VCALENDAR VERSION:2.0 -PRODID:-//Sabre//Sabre VObject 4.5.6//EN +PRODID:-//Sabre//Sabre VObject 4.6.1//EN CALSCALE:GREGORIAN METHOD:REPLY BEGIN:VFREEBUSY @@ -1004,7 +1004,7 @@ private function getFreeBusyResponse(): string { 2.0;Success BEGIN:VCALENDAR VERSION:2.0 -PRODID:-//Sabre//Sabre VObject 4.5.6//EN +PRODID:-//Sabre//Sabre VObject 4.6.1//EN CALSCALE:GREGORIAN METHOD:REPLY BEGIN:VFREEBUSY @@ -1025,7 +1025,7 @@ private function getFreeBusyResponse(): string { 2.0;Success BEGIN:VCALENDAR VERSION:2.0 -PRODID:-//Sabre//Sabre VObject 4.5.6//EN +PRODID:-//Sabre//Sabre VObject 4.6.1//EN CALSCALE:GREGORIAN METHOD:REPLY BEGIN:VFREEBUSY