From fa01bbc98aeedf5d9671d1d70cc2824b587c7361 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 06e32c98090..a39d6ca6630 100644 --- a/apps/files/src/actions/moveOrCopyAction.ts +++ b/apps/files/src/actions/moveOrCopyAction.ts @@ -221,6 +221,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) @@ -236,7 +240,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,