Skip to content

Commit

Permalink
Merge pull request #48516 from nextcloud/backport/48512/stable30
Browse files Browse the repository at this point in the history
  • Loading branch information
Altahrim authored Oct 2, 2024
2 parents 39c6aaf + 1cbd3ce commit 56d88f7
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 15 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
Loading

0 comments on commit 56d88f7

Please sign in to comment.