diff options
author | Carl Schwan <carl@carlschwan.eu> | 2022-06-21 14:19:40 +0300 |
---|---|---|
committer | Max <max@nextcloud.com> | 2022-07-06 11:51:46 +0300 |
commit | 82b1234031585e26e3745809992426808ed60179 (patch) | |
tree | 1536b8b2c5f9e372ce521845b8524efeb50bb9d5 /lib | |
parent | 163eddff42e63f8137da86fc3685583a0add8165 (diff) |
Revert "fix: DAV only return workspace properties if they are set"
This reverts commit 3e40b7bce4b85e4d6d92a56a0323ce8600f8b897.
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/DAV/WorkspacePlugin.php | 43 |
1 files changed, 28 insertions, 15 deletions
diff --git a/lib/DAV/WorkspacePlugin.php b/lib/DAV/WorkspacePlugin.php index 2f88f2d8d..764aa1f36 100644 --- a/lib/DAV/WorkspacePlugin.php +++ b/lib/DAV/WorkspacePlugin.php @@ -97,25 +97,38 @@ class WorkspacePlugin extends ServerPlugin { // Only return the property for the parent node and ignore it for further in depth nodes if ($propFind->getDepth() === $this->server->getHTTPDepth()) { - $owner = $this->userId ?? $node->getFileInfo()->getStorage()->getOwner(''); - /** @var Folder[] $nodes */ - $nodes = $this->rootFolder->getUserFolder($owner)->getById($node->getId()); - if (count($nodes) > 0) { - try { + $propFind->handle(self::WORKSPACE_PROPERTY, function () use ($node) { + /** @var Folder[] $nodes */ + $nodes = $this->rootFolder->getUserFolder($this->userId)->getById($node->getId()); + if (count($nodes) > 0) { /** @var File $file */ - $file = $this->workspaceService->getFile($nodes[0]); - if ($file instanceof File) { - $propFind->handle(self::WORKSPACE_PROPERTY, function () use ($file) { + try { + $file = $this->workspaceService->getFile($nodes[0]); + if ($file instanceof File) { return $file->getContent(); - }); - $propFind->handle(self::WORKSPACE_FILE_PROPERTY, function () use ($file) { - return $file->getFileInfo()->getId(); - }); + } + } catch (StorageNotAvailableException $e) { + // If a storage is not available we can for the propfind response assume that there is no rich workspace present } - } catch (StorageNotAvailableException $e) { - // If a storage is not available we can for the propfind response assume that there is no rich workspace present } - } + return ''; + }); + $propFind->handle(self::WORKSPACE_FILE_PROPERTY, function () use ($node) { + /** @var Folder[] $nodes */ + $nodes = $this->rootFolder->getUserFolder($this->userId)->getById($node->getId()); + if (count($nodes) > 0) { + /** @var File $file */ + try { + $file = $this->workspaceService->getFile($nodes[0]); + if ($file instanceof File) { + return $file->getFileInfo()->getName(); + } + } catch (StorageNotAvailableException $e) { + // If a storage is not available we can for the propfind response assume that there is no rich workspace present + } + } + return ''; + }); } } } |