aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorprovokateurin <kate@provokateurin.de>2025-01-30 17:07:36 +0100
committerprovokateurin <kate@provokateurin.de>2025-02-03 09:36:33 +0100
commitea68ad63b733b0df54fee8c164f4025d637f48be (patch)
tree81d8617b65930866542ec889e4ae44e746ec28d5
parentb6f9356ccf4d24843351dae87c996a6e06c824ed (diff)
downloadnextcloud-server-fix/files/favorites-widget-folder-preview.tar.gz
nextcloud-server-fix/files/favorites-widget-folder-preview.zip
fix(files): Fix folder preview for favorites widgetfix/files/favorites-widget-folder-preview
Signed-off-by: provokateurin <kate@provokateurin.de>
-rw-r--r--apps/files/lib/Dashboard/FavoriteWidget.php20
1 files changed, 13 insertions, 7 deletions
diff --git a/apps/files/lib/Dashboard/FavoriteWidget.php b/apps/files/lib/Dashboard/FavoriteWidget.php
index a36dd65c81b..d4f0291b9c9 100644
--- a/apps/files/lib/Dashboard/FavoriteWidget.php
+++ b/apps/files/lib/Dashboard/FavoriteWidget.php
@@ -18,6 +18,8 @@ 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\Folder;
use OCP\Files\IMimeTypeDetector;
use OCP\Files\IRootFolder;
use OCP\IL10N;
@@ -88,13 +90,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(),
'',