From ee5f011e9019ce6b3da4fca898af1092560d9276 Mon Sep 17 00:00:00 2001 From: Raul Date: Wed, 17 Aug 2022 11:23:59 +0200 Subject: [PATCH] Fix: make sure to hide download option inside Collabora for "hide download" shares Signed-off-by: Raul --- lib/TokenManager.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/TokenManager.php b/lib/TokenManager.php index cd92059f1d..d6f45153a1 100644 --- a/lib/TokenManager.php +++ b/lib/TokenManager.php @@ -38,6 +38,7 @@ use OCP\Share\Exceptions\ShareNotFound; use OCP\Share\IManager; use OCP\IL10N; +use OCP\Share\IShare; use OCP\Util; class TokenManager { @@ -155,13 +156,13 @@ public function getToken($fileId, $shareToken = null, $editoruid = null, $direct $storage = $file->getStorage(); // using string as we have no guarantee that "files_sharing" app is loaded if ($storage->instanceOfStorage(SharedStorage::class)) { - if (!method_exists(SharedStorage::class, 'getAttributes')) { + if (!method_exists(IShare::class, 'getAttributes')) { break; } /** @var SharedStorage $storage */ $share = $storage->getShare(); - $canDownload = $share->getAttributes()->getAttribute('permissions', 'download'); - if ($canDownload !== null && !$canDownload) { + $attributes = $share->getAttributes(); + if ($attributes !== null && !$attributes->getAttribute('permissions', 'download')) { $hideDownload = true; break; }