File tree Expand file tree Collapse file tree 3 files changed +15
-0
lines changed Expand file tree Collapse file tree 3 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -229,6 +229,9 @@ export function getUiOptions(uiSchema) {
229229}
230230
231231export function isObject ( thing ) {
232+ if ( thing instanceof File ) {
233+ return false ;
234+ }
232235 return typeof thing === "object" && thing !== null && ! Array . isArray ( thing ) ;
233236}
234237
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ if (!global.hasOwnProperty("window")) {
66 global . document = jsdom . jsdom ( "<!doctype html><html><body></body></html>" ) ;
77 global . window = document . defaultView ;
88 global . navigator = global . window . navigator ;
9+ global . File = global . window . File ;
910}
1011
1112// atob
Original file line number Diff line number Diff line change @@ -517,6 +517,17 @@ describe("utils", () => {
517517 expect ( mergeObjects ( obj1 , obj2 ) ) . eql ( expected ) ;
518518 } ) ;
519519
520+ it ( "shouldn't recursively merge File object" , ( ) => {
521+ const file = new File ( [ "test" ] , "test.txt" ) ;
522+ const obj1 = {
523+ a : { } ,
524+ } ;
525+ const obj2 = {
526+ a : file ,
527+ } ;
528+ expect ( mergeObjects ( obj1 , obj2 ) . a ) . instanceOf ( File ) ;
529+ } ) ;
530+
520531 describe ( "concatArrays option" , ( ) => {
521532 it ( "should not concat arrays by default" , ( ) => {
522533 const obj1 = { a : [ 1 ] } ;
You can’t perform that action at this time.
0 commit comments