Skip to content

Commit

Permalink
Merge pull request #2390 from nextcloud/bugfix/hide_download_option
Browse files Browse the repository at this point in the history
  • Loading branch information
juliushaertl authored Aug 18, 2022
2 parents 86a28ed + ee5f011 commit 46d811d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/TokenManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 46d811d

Please sign in to comment.