diff options
author | Max <max@nextcloud.com> | 2022-06-22 16:24:30 +0300 |
---|---|---|
committer | Max <max@nextcloud.com> | 2022-07-06 11:51:52 +0300 |
commit | bfe8a1386b09412831c02a2208db954d4d845989 (patch) | |
tree | 9bc61c7d6849638f2f69ac17755665d15a3dfb15 /lib | |
parent | 741d952e13db24cac1ccb59d881fe3a9ef5de02a (diff) |
fix: always handle workspace properties
Signed-off-by: Max <max@nextcloud.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/DAV/WorkspacePlugin.php | 60 |
1 files changed, 29 insertions, 31 deletions
diff --git a/lib/DAV/WorkspacePlugin.php b/lib/DAV/WorkspacePlugin.php index c45d1159e..b4019c6f1 100644 --- a/lib/DAV/WorkspacePlugin.php +++ b/lib/DAV/WorkspacePlugin.php @@ -96,40 +96,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(1)) { - $propFind->handle(self::WORKSPACE_PROPERTY, function () use ($node) { - $owner = $this->userId ?? $node->getFileInfo()->getStorage()->getOwner(''); - /** @var Folder[] $nodes */ - $nodes = $this->rootFolder->getUserFolder($owner)->getById($node->getId()); - if (count($nodes) > 0) { - /** @var File $file */ - try { - $file = $this->workspaceService->getFile($nodes[0]); - if ($file instanceof File) { - return $file->getContent(); - } - } catch (StorageNotAvailableException $e) { - // If a storage is not available we can for the propfind response assume that there is no rich workspace present + $propFind->handle(self::WORKSPACE_PROPERTY, function () use ($node) { + $owner = $this->userId ?? $node->getFileInfo()->getStorage()->getOwner(''); + /** @var Folder[] $nodes */ + $nodes = $this->rootFolder->getUserFolder($owner)->getById($node->getId()); + if (count($nodes) > 0) { + /** @var File $file */ + try { + $file = $this->workspaceService->getFile($nodes[0]); + if ($file instanceof File) { + return $file->getContent(); } + } 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()->getId(); - } - } 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()->getId(); } + } catch (StorageNotAvailableException $e) { + // If a storage is not available we can for the propfind response assume that there is no rich workspace present } - return ''; - }); - } + } + return ''; + }); } } |