From 56953f4315a40641a4999c53a6ce3c9e76311e7b Mon Sep 17 00:00:00 2001 From: Christopher Ng Date: Tue, 1 Oct 2024 15:55:14 -0700 Subject: fix(files): Fix folders not being selectable in the smart picker Signed-off-by: Christopher Ng --- .../files/src/views/FileReferencePickerElement.vue | 23 +++++++++++----------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/apps/files/src/views/FileReferencePickerElement.vue b/apps/files/src/views/FileReferencePickerElement.vue index c2a502ee1a8..b4d4bc54f14 100644 --- a/apps/files/src/views/FileReferencePickerElement.vue +++ b/apps/files/src/views/FileReferencePickerElement.vue @@ -39,7 +39,7 @@ export default defineComponent({ }, filepickerOptions() { return { - allowPickDirectory: false, + allowPickDirectory: true, buttons: this.buttonFactory, container: `#${this.containerId}`, multiselect: false, @@ -53,18 +53,17 @@ export default defineComponent({ buttonFactory(selected: NcNode[]): IFilePickerButton[] { const buttons = [] as IFilePickerButton[] if (selected.length === 0) { - buttons.push({ - label: t('files', 'Choose file'), - type: 'tertiary' as never, - callback: this.onClose, - }) - } else { - buttons.push({ - label: t('files', 'Choose {file}', { file: selected[0].basename }), - type: 'primary', - callback: this.onClose, - }) + return [] + } + const node = selected.at(0) + if (node.path === '/') { + return [] // Do not allow selecting the users root folder } + buttons.push({ + label: t('files', 'Choose {file}', { file: node.displayname }), + type: 'primary', + callback: this.onClose, + }) return buttons }, -- cgit v1.2.3