From 2b19fe0fa0b34749a882b8f2627da355f5c91848 Mon Sep 17 00:00:00 2001 From: Tamino Bauknecht Date: Tue, 7 Nov 2023 21:53:55 +0100 Subject: [PATCH] feature(dav/file): Add readlink method --- apps/dav/lib/Connector/Sabre/File.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/apps/dav/lib/Connector/Sabre/File.php b/apps/dav/lib/Connector/Sabre/File.php index 8ce8c843a6628..ab0d5da1ead37 100644 --- a/apps/dav/lib/Connector/Sabre/File.php +++ b/apps/dav/lib/Connector/Sabre/File.php @@ -557,6 +557,26 @@ public function delete() { } } + /** + * Return symlink target of the file + * + * @return string|null + * @throws NotFound + * @throws Forbidden + * @throws FileLocked + */ + public function readlink() { + if (!$this->info->isReadable()) { + throw new NotFound(); + } + + try { + return $this->fileView->readlink($this->path); + } catch (\Exception $e) { + $this->convertToSabreException($e); + } + } + /** * Returns the mime-type for a file *