From d3315bf32a8c966b3a7aea45c3df762277e1e2a0 Mon Sep 17 00:00:00 2001 From: Max Date: Tue, 22 Feb 2022 04:15:39 +0100 Subject: fix: workspace with alternative file names Signed-off-by: Max --- lib/DAV/WorkspacePlugin.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'lib') diff --git a/lib/DAV/WorkspacePlugin.php b/lib/DAV/WorkspacePlugin.php index a7c7e896b..764aa1f36 100644 --- a/lib/DAV/WorkspacePlugin.php +++ b/lib/DAV/WorkspacePlugin.php @@ -41,6 +41,7 @@ use Sabre\DAV\ServerPlugin; class WorkspacePlugin extends ServerPlugin { public const WORKSPACE_PROPERTY = '{http://nextcloud.org/ns}rich-workspace'; + public const WORKSPACE_FILE_PROPERTY = '{http://nextcloud.org/ns}rich-workspace-file'; /** @var Server */ private $server; @@ -112,6 +113,22 @@ class WorkspacePlugin extends ServerPlugin { } 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 ''; + }); } } } -- cgit v1.2.3