diff options
Diffstat (limited to 'apps/files/src/actions/viewInFolderAction.ts')
-rw-r--r-- | apps/files/src/actions/viewInFolderAction.ts | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/apps/files/src/actions/viewInFolderAction.ts b/apps/files/src/actions/viewInFolderAction.ts index 6cf6266fb64..b22393c1152 100644 --- a/apps/files/src/actions/viewInFolderAction.ts +++ b/apps/files/src/actions/viewInFolderAction.ts @@ -2,9 +2,13 @@ * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later */ -import { Node, FileType, Permission, View, FileAction } from '@nextcloud/files' -import { translate as t } from '@nextcloud/l10n' -import FolderMoveSvg from '@mdi/svg/svg/folder-move.svg?raw' +import type { Node, View } from '@nextcloud/files' + +import { isPublicShare } from '@nextcloud/sharing/public' +import { FileAction, FileType, Permission } from '@nextcloud/files' +import { t } from '@nextcloud/l10n' + +import FolderMoveSvg from '@mdi/svg/svg/folder-move-outline.svg?raw' export const action = new FileAction({ id: 'view-in-folder', @@ -14,6 +18,11 @@ export const action = new FileAction({ iconSvgInline: () => FolderMoveSvg, enabled(nodes: Node[], view: View) { + // Not enabled for public shares + if (isPublicShare()) { + return false + } + // Only works outside of the main files view if (view.id === 'files') { return false @@ -30,6 +39,11 @@ export const action = new FileAction({ return false } + // Can only view files that are in the user root folder + if (!node.root?.startsWith('/files')) { + return false + } + if (node.permissions === Permission.NONE) { return false } @@ -44,7 +58,7 @@ export const action = new FileAction({ window.OCP.Files.Router.goToRoute( null, - { view: 'files', fileid: node.fileid }, + { view: 'files', fileid: String(node.fileid) }, { dir: node.dirname }, ) return null |