diff --git a/lib/Controller/PreviewController.php b/lib/Controller/PreviewController.php
index c19ea36e0..bc32255db 100644
--- a/lib/Controller/PreviewController.php
+++ b/lib/Controller/PreviewController.php
@@ -90,6 +90,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 = [];
diff --git a/tests/psalm-baseline.xml b/tests/psalm-baseline.xml
index 3e9dbb515..0478a8d04 100644
--- a/tests/psalm-baseline.xml
+++ b/tests/psalm-baseline.xml
@@ -6,10 +6,19 @@
\OCA\GroupFolders\Mount\GroupFolderStorage
+
+
+ OCA\Files_Sharing\SharedStorage
+
+
+ SharedStorage
+
+
new SearchQuery(new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'systemtag', $tag->getName()), 0, 0, [], $user)
+
$e
LoadSidebar