Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/text.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMax <max@nextcloud.com>2022-02-24 17:01:26 +0300
committerMax <max@nextcloud.com>2022-03-02 10:19:29 +0300
commit3e40b7bce4b85e4d6d92a56a0323ce8600f8b897 (patch)
tree71c7693bebac75bf30bebb7a25bd20bf695cc253 /lib
parent3886c549b687d700404c5245f9a4e85502332d11 (diff)
fix: DAV only return workspace properties if they are set
Also fix retrieving the file for public shares as proposed by @juliushaertl. Signed-off-by: Max <max@nextcloud.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/DAV/WorkspacePlugin.php43
1 files changed, 15 insertions, 28 deletions
diff --git a/lib/DAV/WorkspacePlugin.php b/lib/DAV/WorkspacePlugin.php
index 764aa1f36..2f88f2d8d 100644
--- a/lib/DAV/WorkspacePlugin.php
+++ b/lib/DAV/WorkspacePlugin.php
@@ -97,38 +97,25 @@ 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()) {
- $propFind->handle(self::WORKSPACE_PROPERTY, function () use ($node) {
- /** @var Folder[] $nodes */
- $nodes = $this->rootFolder->getUserFolder($this->userId)->getById($node->getId());
- if (count($nodes) > 0) {
+ $owner = $this->userId ?? $node->getFileInfo()->getStorage()->getOwner('');
+ /** @var Folder[] $nodes */
+ $nodes = $this->rootFolder->getUserFolder($owner)->getById($node->getId());
+ if (count($nodes) > 0) {
+ try {
/** @var File $file */
- try {
- $file = $this->workspaceService->getFile($nodes[0]);
- if ($file instanceof File) {
+ $file = $this->workspaceService->getFile($nodes[0]);
+ if ($file instanceof File) {
+ $propFind->handle(self::WORKSPACE_PROPERTY, function () use ($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_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
}
- 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 '';
- });
+ }
}
}
}