Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable29] Check download attribute when fetching previews #2439

Merged
merged 1 commit into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions lib/Controller/PreviewController.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

namespace OCA\Photos\Controller;

use OCA\Files_Sharing\SharedStorage;
use OCA\Photos\Album\AlbumMapper;
use OCA\Photos\AppInfo\Application;
use OCP\AppFramework\Controller;
Expand Down Expand Up @@ -90,6 +91,21 @@ public function index(
}

$nodes = $this->userFolder->getById($fileId);
$nodes = array_filter(
$nodes,
function ($node) {
$storage = $node->getStorage();
if (!$storage->instanceOfStorage(SharedStorage::class)) {
return true;
}

/** @var SharedStorage $storage */
$share = $storage->getShare();
$attributes = $share->getAttributes();

return $attributes === null || $attributes->getAttribute('permissions', 'download') !== false;
},
);

/** @var \OCA\Photos\Album\AlbumInfo[] */
$checkedAlbums = [];
Expand Down
9 changes: 9 additions & 0 deletions tests/psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,20 @@
<code>\OCA\GroupFolders\Mount\GroupFolderStorage</code>
</UndefinedClass>
</file>
<file src="lib/Controller/PreviewController.php">
<UndefinedDocblockClass occurrences="4">
<code>OCA\Files_Sharing\SharedStorage</code>
</UndefinedDocblockClass>
<UndefinedClass occurrences="1">
<code>SharedStorage</code>
</UndefinedClass>
</file>
<file src="lib/Controller/PageController.php">
<InvalidArgument occurrences="1">
<code>new SearchQuery(new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'systemtag',
$tag-&gt;getName()), 0, 0, [], $user)</code>
</InvalidArgument>

<UndefinedClass occurrences="12">
<code>$e</code>
<code>LoadSidebar</code>
Expand Down
Loading