Skip to content

Commit

Permalink
Merge pull request #40174 from owncloud/searchingInProjectSpace
Browse files Browse the repository at this point in the history
[tests-only] [full-ci] Add the ability to find an object in the project space
  • Loading branch information
phil-davis authored Jun 30, 2022
2 parents ca42946 + dc1f517 commit 7e9caa4
Showing 1 changed file with 12 additions and 16 deletions.
28 changes: 12 additions & 16 deletions tests/acceptance/features/bootstrap/WebDav.php
Original file line number Diff line number Diff line change
Expand Up @@ -5276,20 +5276,9 @@ public function findEntryFromPropfindResponse(
if ($entryNameToSearch != null) {
$trimmedEntryNameToSearch = \trim($entryNameToSearch, "/");
}

// topWebDavPath should be something like /remote.php/webdav/ or
// /remote.php/dav/files/alice/
$topWebDavPath = "/" . $this->getFullDavFilesPath($user) . "/";
if (OcisHelper::isTestingOnOcis() && $method === "REPORT") {
$spaceId = WebDavHelper::getPersonalSpaceIdForUser(
$this->getBaseUrl(),
$user,
$this->getPasswordForUser($user),
$this->getStepLineRef()
);
$userId = $this->getAttributeOfCreatedUser($user, "id");
$topWebDavPath = "/dav/spaces/" . $spaceId . "%21" . $userId . "/";
}

switch ($type) {
case "files":
Expand All @@ -5307,11 +5296,18 @@ public function findEntryFromPropfindResponse(
if ($multistatusResults !== null) {
foreach ($multistatusResults as $multistatusResult) {
$entryPath = $multistatusResult['value'][0]['value'];
$entryName = \str_replace($topWebDavPath, "", $entryPath);
$entryName = \rawurldecode($entryName);
$entryName = \trim($entryName, "/");
if ($trimmedEntryNameToSearch === $entryName) {
return $multistatusResult;
if (OcisHelper::isTestingOnOcis() && $method === "REPORT") {
$entryName = \rawurldecode($entryPath);
if (str_ends_with($entryName, $entryNameToSearch)) {
return $multistatusResult;
}
} else {
$entryName = \str_replace($topWebDavPath, "", $entryPath);
$entryName = \rawurldecode($entryName);
$entryName = \trim($entryName, "/");
if ($trimmedEntryNameToSearch === $entryName) {
return $multistatusResult;
}
}
\array_push($results, $entryName);
}
Expand Down

0 comments on commit 7e9caa4

Please sign in to comment.