diff options
author | Max <max@nextcloud.com> | 2022-02-22 06:15:39 +0300 |
---|---|---|
committer | Max <max@nextcloud.com> | 2022-03-02 10:19:16 +0300 |
commit | d3315bf32a8c966b3a7aea45c3df762277e1e2a0 (patch) | |
tree | 2a6e3b9a8c0aba35a0c90f160fdeb02733704fbf /lib | |
parent | 7782f4ddfb05bbbb78f25778999c8b74290b4874 (diff) |
fix: workspace with alternative file names
Signed-off-by: Max <max@nextcloud.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/DAV/WorkspacePlugin.php | 17 |
1 files changed, 17 insertions, 0 deletions
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 ''; + }); } } } |