summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Ng <chrng8@gmail.com>2024-10-01 15:55:14 -0700
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2024-10-02 09:09:04 +0000
commit56953f4315a40641a4999c53a6ce3c9e76311e7b (patch)
tree0676465af7ee9f7897551d18d9d8969abc590e87
parent8290de3b9333ff692a1d56191aaa1bdd2b56872c (diff)
downloadnextcloud-server-56953f4315a40641a4999c53a6ce3c9e76311e7b.tar.gz
nextcloud-server-56953f4315a40641a4999c53a6ce3c9e76311e7b.zip
fix(files): Fix folders not being selectable in the smart picker
Signed-off-by: Christopher Ng <chrng8@gmail.com>
-rw-r--r--apps/files/src/views/FileReferencePickerElement.vue23
1 files 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
},