diff options
author | provokateurin <kate@provokateurin.de> | 2025-01-30 17:07:36 +0100 |
---|---|---|
committer | backportbot[bot] <backportbot[bot]@users.noreply.github.com> | 2025-02-03 09:57:02 +0000 |
commit | 9d1cab21b2a9c9251f9dbfab62819afc95d58965 (patch) | |
tree | d58942e7d13c948d891a2bc73839e4d3e7420f33 /apps/files | |
parent | aaad1e588b901788fe09ab39609aed49e426ec4c (diff) | |
download | nextcloud-server-9d1cab21b2a9c9251f9dbfab62819afc95d58965.tar.gz nextcloud-server-9d1cab21b2a9c9251f9dbfab62819afc95d58965.zip |
fix(files): Fix folder preview for favorites widgetbackport/50576/stable31
Signed-off-by: provokateurin <kate@provokateurin.de>
Diffstat (limited to 'apps/files')
-rw-r--r-- | apps/files/lib/Dashboard/FavoriteWidget.php | 19 |
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(), '', |