diff --git a/lib/DAV/Client.php b/lib/DAV/Client.php index 03b98b11d7..e600b55f48 100644 --- a/lib/DAV/Client.php +++ b/lib/DAV/Client.php @@ -242,19 +242,11 @@ public function propFindUnfiltered($url, array $properties, $depth = 0) // If depth was 0, we only return the top item if (0 === $depth) { reset($result); - $statusList = current($result); - foreach ($statusList as $statusCode => $associatedProperties) { - $newResult[] = ['properties' => $associatedProperties, 'status' => $statusCode]; - } + + return current($result); } else { - foreach ($result as $href => $statusList) { - foreach ($statusList as $statusCode => $associatedProperties) { - $newResult[$href][] = ['properties' => $associatedProperties, 'status' => $statusCode]; - } - } + return $result; } - - return $newResult; } /** diff --git a/tests/Sabre/DAV/ClientTest.php b/tests/Sabre/DAV/ClientTest.php index 9353b691b7..e19ec07b44 100644 --- a/tests/Sabre/DAV/ClientTest.php +++ b/tests/Sabre/DAV/ClientTest.php @@ -310,18 +310,12 @@ public function testPropFindUnfilteredDepth0() $result = $client->propFindUnfiltered('folder1', ['{DAV:}resourcetype', '{DAV:}displayname', '{DAV:}contentlength', '{urn:zim}gir']); self::assertEquals([ - [ - 'properties' => [ - '{DAV:}resourcetype' => new Xml\Property\ResourceType('{DAV:}collection'), - '{DAV:}displayname' => 'Folder1', - ], - 'status' => 200, + 200 => [ + '{DAV:}resourcetype' => new Xml\Property\ResourceType('{DAV:}collection'), + '{DAV:}displayname' => 'Folder1', ], - [ - 'properties' => [ - '{DAV:}contentlength' => null, - ], - 'status' => 404, + 404 => [ + '{DAV:}contentlength' => null, ], ], $result); @@ -424,63 +418,42 @@ public function testPropFindUnfiltered() self::assertEquals([ '/folder1' => [ - [ - 'properties' => [ - '{DAV:}resourcetype' => new Xml\Property\ResourceType('{DAV:}collection'), - '{DAV:}displayname' => 'Folder1', - ], - 'status' => 200, + 200 => [ + '{DAV:}resourcetype' => new Xml\Property\ResourceType('{DAV:}collection'), + '{DAV:}displayname' => 'Folder1', ], - [ - 'properties' => [ - '{DAV:}contentlength' => null, - ], - 'status' => 404, + 404 => [ + '{DAV:}contentlength' => null, ], ], '/folder1/file1.txt' => [ - [ - 'properties' => [ - '{DAV:}resourcetype' => null, - '{DAV:}displayname' => 'File1', - '{DAV:}contentlength' => 12, - ], - 'status' => 200, + 200 => [ + '{DAV:}resourcetype' => null, + '{DAV:}displayname' => 'File1', + '{DAV:}contentlength' => 12, ], ], '/folder1/file2.txt' => [ - [ - 'properties' => [ - '{DAV:}resourcetype' => null, - '{DAV:}displayname' => 'File2', - '{DAV:}contentlength' => 27, - ], - 'status' => 403, + 403 => [ + '{DAV:}resourcetype' => null, + '{DAV:}displayname' => 'File2', + '{DAV:}contentlength' => 27, ], ], '/folder1/file3.txt' => [ - [ - 'properties' => [ - '{DAV:}resourcetype' => null, - '{DAV:}displayname' => 'File3', - '{DAV:}contentlength' => 42, - ], - 'status' => 425, + 425 => [ + '{DAV:}resourcetype' => null, + '{DAV:}displayname' => 'File3', + '{DAV:}contentlength' => 42, ], ], '/folder1/subfolder' => [ - [ - 'properties' => [ - '{DAV:}resourcetype' => new Xml\Property\ResourceType('{DAV:}collection'), - '{DAV:}displayname' => 'SubFolder', - ], - 'status' => 200, + 200 => [ + '{DAV:}resourcetype' => new Xml\Property\ResourceType('{DAV:}collection'), + '{DAV:}displayname' => 'SubFolder', ], - [ - 'properties' => [ - '{DAV:}contentlength' => null, - ], - 'status' => 404, + 404 => [ + '{DAV:}contentlength' => null, ], ], ], $result);