Skip to content

Commit

Permalink
fix(files): Fix folders not being selectable in the smart picker
Browse files Browse the repository at this point in the history
Signed-off-by: Christopher Ng <[email protected]>
  • Loading branch information
Pytal committed Oct 1, 2024
1 parent 0e1cb72 commit 51bb8d0
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions apps/files/src/views/FileReferencePickerElement.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default defineComponent({
},
filepickerOptions() {
return {
allowPickDirectory: false,
allowPickDirectory: true,
buttons: this.buttonFactory,
container: `#${this.containerId}`,
multiselect: false,
Expand All @@ -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
},
Expand Down

0 comments on commit 51bb8d0

Please sign in to comment.