diff --git a/lib/Controller/PreviewController.php b/lib/Controller/PreviewController.php
index 87b7c7769..b20831730 100644
--- a/lib/Controller/PreviewController.php
+++ b/lib/Controller/PreviewController.php
@@ -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;
@@ -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 = [];
diff --git a/tests/psalm-baseline.xml b/tests/psalm-baseline.xml
index d8c4ea7b5..c35e81446 100644
--- a/tests/psalm-baseline.xml
+++ b/tests/psalm-baseline.xml
@@ -6,11 +6,20 @@
\OCA\GroupFolders\Mount\GroupFolderStorage
+
+
+ OCA\Files_Sharing\SharedStorage
+
+
+ SharedStorage
+
+
new SearchQuery(new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'systemtag',
$tag->getName()), 0, 0, [], $user)
+
$e
LoadSidebar