File tree Expand file tree Collapse file tree 2 files changed +12
-9
lines changed
Expand file tree Collapse file tree 2 files changed +12
-9
lines changed Original file line number Diff line number Diff line change @@ -197,7 +197,7 @@ export function canUseFileSystemAccessAPI() {
197197 */
198198export function pickerOptionsFromAccept ( accept ) {
199199 if ( isDefined ( accept ) ) {
200- return Object . entries ( accept )
200+ const acceptForPicker = Object . entries ( accept )
201201 . filter ( ( [ mimeType , ext ] ) => {
202202 let ok = true ;
203203
@@ -217,11 +217,18 @@ export function pickerOptionsFromAccept(accept) {
217217
218218 return ok ;
219219 } )
220- . map ( ( [ mimeType , ext ] ) => ( {
221- accept : {
220+ . reduce (
221+ ( agg , [ mimeType , ext ] ) => ( {
222+ ...agg ,
222223 [ mimeType ] : ext ,
223- } ,
224- } ) ) ;
224+ } ) ,
225+ { }
226+ ) ;
227+ return [
228+ {
229+ accept : acceptForPicker ,
230+ } ,
231+ ] ;
225232 }
226233 return accept ;
227234}
Original file line number Diff line number Diff line change @@ -415,10 +415,6 @@ describe("pickerOptionsFromAccept()", () => {
415415 {
416416 accept : {
417417 "image/*" : [ ".png" , ".jpg" ] ,
418- } ,
419- } ,
420- {
421- accept : {
422418 "text/*" : [ ".txt" , ".pdf" ] ,
423419 } ,
424420 } ,
You can’t perform that action at this time.
0 commit comments