Skip to content

Commit

Permalink
Merge pull request #192 from nextcloud/bugfix/share-attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
juliusknorr authored Dec 20, 2023
2 parents 768652a + c4a68aa commit 4320453
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions lib/Service/ZipService.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
use Exception;
use Icewind\Streams\CountWrapper;
use OC\User\NoUserException;
use OCA\Files_Sharing\SharedStorage;
use OCA\FilesZip\AppInfo\Application;
use OCA\FilesZip\BackgroundJob\ZipJob;
use OCA\FilesZip\Exceptions\MaximumSizeReachedException;
Expand All @@ -44,6 +45,8 @@
use OCP\IConfig;
use OCP\IUserSession;
use OCP\Lock\LockedException;
use OCP\Share\IAttributes;
use OCP\Share\IShare;
use ZipStreamer\ZipStreamer;

class ZipService {
Expand Down Expand Up @@ -154,7 +157,20 @@ private function verifyAndGetFiles($uid, $fileIds, $target): array {
continue;
}

/** @var Node $node */
$node = array_pop($nodes);

// Skip incoming shares without download permission
$storage = $node->getStorage();
if ($node->isShared() && $storage->instanceOfStorage(SharedStorage::class) && method_exists(IShare::class, 'getAttributes')) {
/** @var SharedStorage $storage */
$share = $storage->getShare();
$hasShareAttributes = $share && $share->getAttributes() instanceof IAttributes;
if ($hasShareAttributes && $share->getAttributes()->getAttribute('permissions', 'download') === false) {
continue;
}
}

$files[] = $node;
$size += $node->getSize();
}
Expand Down

0 comments on commit 4320453

Please sign in to comment.