From fd4707c600ae58d89faff64c3c83939bcd731e01 Mon Sep 17 00:00:00 2001 From: Louis Chmn Date: Fri, 17 Oct 2025 11:05:44 +0200 Subject: [PATCH] fix(FilesPicker): Prevent selection of nodes without create permission And remove the disable callback for the button as it is not needed anymore. This gives a better experience as the nodes do not have a pointer for cursor, and the submit button does not react when clicking on them. Signed-off-by: Louis Chmn --- apps/files/src/actions/moveOrCopyAction.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/files/src/actions/moveOrCopyAction.ts b/apps/files/src/actions/moveOrCopyAction.ts index 8c02c62ca25..cd90a6ca917 100644 --- a/apps/files/src/actions/moveOrCopyAction.ts +++ b/apps/files/src/actions/moveOrCopyAction.ts @@ -222,6 +222,10 @@ async function openFilePickerForAction( // We don't want to show the current nodes in the file picker return !fileIDs.includes(n.fileid) }) + .setCanPick((n) => { + const hasCreatePermissions = (n.permissions & Permission.CREATE) === Permission.CREATE + return hasCreatePermissions + }) .setMimeTypeFilter([]) .setMultiSelect(false) .startAt(dir) @@ -237,7 +241,6 @@ async function openFilePickerForAction( label: target ? t('files', 'Copy to {target}', { target }, undefined, { escape: false, sanitize: false }) : t('files', 'Copy'), type: 'primary', icon: CopyIconSvg, - disabled: selection.some((node) => (node.permissions & Permission.CREATE) === 0), async callback(destination: Node[]) { resolve({ destination: destination[0] as Folder,