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[] {
105105 ) ;
106106}
107107
108- function fromDataTransferItem (
108+ async function fromDataTransferItem (
109109 item : DataTransferItem ,
110110 entry ?: FileSystemEntry | null ,
111111) {
@@ -118,18 +118,17 @@ function fromDataTransferItem(
118118 globalThis . isSecureContext &&
119119 typeof ( item as any ) . getAsFileSystemHandle === "function"
120120 ) {
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 ) ;
126125 }
127126 const file = item . getAsFile ( ) ;
128127 if ( ! file ) {
129- return Promise . reject ( `${ item } is not a File` ) ;
128+ throw new Error ( `${ item } is not a File` ) ;
130129 }
131130 const fwp = toFileWithPath ( file , entry ?. fullPath ?? undefined ) ;
132- return Promise . resolve ( fwp ) ;
131+ return fwp ;
133132}
134133
135134async function fromEntry (
You can’t perform that action at this time.
0 commit comments