Skip to content

Commit eba2e00

Browse files
authored
Merge pull request #1775 from nextcloud-libraries/fix/filepicker-pick-return
2 parents 1e10136 + e6ec02d commit eba2e00

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/filepicker-builder.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,10 @@ export class FilePicker<IsMultiSelect extends boolean> {
9898
public async pick(): Promise<IsMultiSelect extends true ? string[] : string> {
9999
const nodes = await this.pickNodes()
100100
if (this.multiSelect) {
101-
return (nodes[0]?.path ?? '/') as (IsMultiSelect extends true ? string[] : string)
101+
return nodes.map((node) => node.path) as (IsMultiSelect extends true ? string[] : string)
102102
}
103-
return nodes.map((node) => node.path) as (IsMultiSelect extends true ? string[] : string)
103+
const path = nodes[0]?.path ?? '/'
104+
return path as (IsMultiSelect extends true ? string[] : string)
104105
}
105106
}
106107

0 commit comments

Comments
 (0)