From ecd3e255884ab590e76c89d66d4a1cd34cb34a99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Mon, 3 May 2021 08:31:46 +0200 Subject: [PATCH] Get attachment from the user node instead of the share source MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- lib/Service/FilesAppService.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/Service/FilesAppService.php b/lib/Service/FilesAppService.php index 53acbaeac..832565a27 100644 --- a/lib/Service/FilesAppService.php +++ b/lib/Service/FilesAppService.php @@ -125,7 +125,11 @@ class FilesAppService implements IAttachmentService, ICustomAttachmentService { public function extendData(Attachment $attachment) { $userFolder = $this->rootFolder->getUserFolder($this->userId); $share = $this->shareProvider->getShareById($attachment->getId()); - $file = $share->getNode(); + $files = $userFolder->getById($share->getNode()->getId()); + if (count($files) === 0) { + return $attachment; + } + $file = array_shift($files); $attachment->setExtendedData([ 'path' => $userFolder->getRelativePath($file->getPath()), 'fileid' => $file->getId(),