From 40cd5b8e2f19cecddbc72b1cb8dab4f0e016968d Mon Sep 17 00:00:00 2001 From: Michiel de Jong Date: Wed, 10 May 2023 10:43:57 +0000 Subject: [PATCH] Fix #300 --- lib/Controller/RevaController.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/Controller/RevaController.php b/lib/Controller/RevaController.php index 0d609924..252890ec 100644 --- a/lib/Controller/RevaController.php +++ b/lib/Controller/RevaController.php @@ -546,10 +546,17 @@ public function EmptyRecycle($userId) { * @return Http\DataResponse|JSONResponse */ public function GetMD($userId) { - error_log("GetMD"); $this->init($userId); $ref = $this->request->getParam("ref"); - $path = $this->revaPathToNextcloudPath($ref["path"]); // FIXME: normalize incoming path + error_log("GetMD " . var_export($ref, true)); + if (isset($ref["path"])) { + $revaPath = $ref["path"]; // e.g. GetMD {"ref":{"path":"/home/asdf"},"mdKeys":null} + } else if (isset($ref["resource_id"]) && isset($ref["resource_id"]["opaque_id"]) && str_starts_with($ref["resource_id"]["opaque_id"], "fileid-/home/")) { + $revaPath = substr($ref["resource_id"]["opaque_id"], strlen("fileid-")); // e.g. GetMD {"ref":{"resource_id":{"storage_id":"00000000-0000-0000-0000-000000000000","opaque_id":"fileid-/home/asdf"}},"mdKeys":null} + } else { + throw new \Exception("ref not understood!"); + } + $path = $this->revaPathToNextcloudPath($revaPath); error_log("Looking for nc path '$path' in user folder; reva path '".$ref["path"]."' "); $dirContents = $this->userFolder->getDirectoryListing(); $paths = array_map(function (\OCP\Files\Node $node) {