From 5d579993f08adbcfa18bac09ebd25abe9ff7fedf Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Wed, 22 Apr 2026 17:20:52 +0200 Subject: [PATCH] fix(files): do not show convert-file action in view-only shares Signed-off-by: Ferdinand Thiessen --- apps/files/src/actions/convertAction.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/apps/files/src/actions/convertAction.ts b/apps/files/src/actions/convertAction.ts index e9fa7862380..9443809ea0a 100644 --- a/apps/files/src/actions/convertAction.ts +++ b/apps/files/src/actions/convertAction.ts @@ -7,9 +7,10 @@ import type { IFileAction } from '@nextcloud/files' import AutoRenewSvg from '@mdi/svg/svg/autorenew.svg?raw' import { getCapabilities } from '@nextcloud/capabilities' -import { registerFileAction } from '@nextcloud/files' +import { Permission, registerFileAction } from '@nextcloud/files' import { t } from '@nextcloud/l10n' import { generateUrl } from '@nextcloud/router' +import { isPublicShare } from '@nextcloud/sharing/public' import { convertFile, convertFiles } from './convertUtils.ts' type ConversionsProvider = { @@ -30,7 +31,11 @@ export function registerConvertActions() { id: `convert-${from}-${to}`, displayName: () => t('files', 'Save as {displayName}', { displayName }), iconSvgInline: () => generateIconSvg(to), - enabled: ({ nodes }) => { + enabled: ({ nodes, folder }) => { + if (isPublicShare() && !(folder.permissions & Permission.CREATE)) { + // cannot create the converted file in a public share if we don't have create permissions + return false + } // Check that all nodes have the same mime type return nodes.every((node) => from === node.mime) },