File tree Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -105,7 +105,7 @@ function flatten<T>(items: any[]): T[] {
105
105
) ;
106
106
}
107
107
108
- function fromDataTransferItem (
108
+ async function fromDataTransferItem (
109
109
item : DataTransferItem ,
110
110
entry ?: FileSystemEntry | null ,
111
111
) {
@@ -118,18 +118,17 @@ function fromDataTransferItem(
118
118
globalThis . isSecureContext &&
119
119
typeof ( item as any ) . getAsFileSystemHandle === "function"
120
120
) {
121
- return ( item as any ) . getAsFileSystemHandle ( ) . then ( async ( h : any ) => {
122
- const file = await h . getFile ( ) ;
123
- file . handle = h ;
124
- return toFileWithPath ( file ) ;
125
- } ) ;
121
+ const h = await ( item as any ) . getAsFileSystemHandle ( ) ;
122
+ const file = await h . getFile ( ) ;
123
+ file . handle = h ;
124
+ return toFileWithPath ( file ) ;
126
125
}
127
126
const file = item . getAsFile ( ) ;
128
127
if ( ! file ) {
129
- return Promise . reject ( `${ item } is not a File` ) ;
128
+ throw new Error ( `${ item } is not a File` ) ;
130
129
}
131
130
const fwp = toFileWithPath ( file , entry ?. fullPath ?? undefined ) ;
132
- return Promise . resolve ( fwp ) ;
131
+ return fwp ;
133
132
}
134
133
135
134
async function fromEntry (
You can’t perform that action at this time.
0 commit comments