diff --git a/lib/Controller/RevaController.php b/lib/Controller/RevaController.php index af23d8e2..62bf36bf 100644 --- a/lib/Controller/RevaController.php +++ b/lib/Controller/RevaController.php @@ -573,10 +573,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) {