aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKate <26026535+provokateurin@users.noreply.github.com>2025-02-03 10:56:00 +0100
committerGitHub <noreply@github.com>2025-02-03 10:56:00 +0100
commitc38aa33db9b8f9964e420dd01f66851019dae4d7 (patch)
treee74f7f8f944520010ef71070d06cd9f6f2b1393b
parent8be4ad75b3734a692c6d07db3a0d2fc37288a102 (diff)
parent6ada9dda01c2c63939d417dfec28500588b2debf (diff)
downloadnextcloud-server-c38aa33db9b8f9964e420dd01f66851019dae4d7.tar.gz
nextcloud-server-c38aa33db9b8f9964e420dd01f66851019dae4d7.zip
Merge pull request #50576 from nextcloud/fix/files/favorites-widget-folder-preview
-rw-r--r--apps/files/lib/Dashboard/FavoriteWidget.php19
1 files changed, 12 insertions, 7 deletions
diff --git a/apps/files/lib/Dashboard/FavoriteWidget.php b/apps/files/lib/Dashboard/FavoriteWidget.php
index a36dd65c81b..b68b8a56b2e 100644
--- a/apps/files/lib/Dashboard/FavoriteWidget.php
+++ b/apps/files/lib/Dashboard/FavoriteWidget.php
@@ -18,6 +18,7 @@ use OCP\Dashboard\Model\WidgetButton;
use OCP\Dashboard\Model\WidgetItem;
use OCP\Dashboard\Model\WidgetItems;
use OCP\Dashboard\Model\WidgetOptions;
+use OCP\Files\File;
use OCP\Files\IMimeTypeDetector;
use OCP\Files\IRootFolder;
use OCP\IL10N;
@@ -88,13 +89,17 @@ class FavoriteWidget implements IIconWidget, IAPIWidgetV2, IButtonWidget, IOptio
$url = $this->urlGenerator->linkToRouteAbsolute(
'files.view.showFile', ['fileid' => $node->getId()]
);
- $icon = $this->urlGenerator->linkToRouteAbsolute('core.Preview.getPreviewByFileId', [
- 'x' => 256,
- 'y' => 256,
- 'fileId' => $node->getId(),
- 'c' => $node->getEtag(),
- 'mimeFallback' => true,
- ]);
+ if ($node instanceof File) {
+ $icon = $this->urlGenerator->linkToRouteAbsolute('core.Preview.getPreviewByFileId', [
+ 'x' => 256,
+ 'y' => 256,
+ 'fileId' => $node->getId(),
+ 'c' => $node->getEtag(),
+ 'mimeFallback' => true,
+ ]);
+ } else {
+ $icon = $this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'filetypes/folder.svg'));
+ }
$favoriteNodes[] = new WidgetItem(
$node->getName(),
'',