File tree Expand file tree Collapse file tree 1 file changed +13
-9
lines changed
Expand file tree Collapse file tree 1 file changed +13
-9
lines changed Original file line number Diff line number Diff line change @@ -116,14 +116,22 @@ module.exports = function(AV) {
116116 }
117117 }
118118
119- if ( typeof File !== "undefined" && data instanceof File && data . name ) {
120- this . _extName = extname ( data . name ) ;
119+ if ( typeof File !== "undefined" && data instanceof File ) {
120+ if ( data . size ) {
121+ this . attributes . metaData . size = data . size ;
122+ }
123+ if ( data . name ) {
124+ this . _extName = extname ( data . name ) ;
125+ }
121126 }
122127
123128 if ( ! process . env . CLIENT_PLATFORM ) {
124129 if ( data instanceof require ( 'stream' ) ) {
125130 this . _extName = extname ( data . path ) ;
126131 }
132+ if ( Buffer . isBuffer ( data ) ) {
133+ this . attributes . metaData . size = data . length ;
134+ }
127135 }
128136
129137 let owner ;
@@ -471,19 +479,15 @@ module.exports = function(AV) {
471479 return data . blob ;
472480 }
473481 if ( typeof File !== "undefined" && data instanceof File ) {
474- if ( data . size ) {
475- this . attributes . metaData . size = data . size ;
476- }
477482 return data ;
478483 }
479484 if ( ! process . env . CLIENT_PLATFORM ) {
480485 if ( data instanceof require ( 'stream' ) ) {
481486 return data ;
482487 }
483- }
484- if ( typeof Buffer !== "undefined" && Buffer . isBuffer ( data ) ) {
485- this . attributes . metaData . size = data . length ;
486- return data ;
488+ if ( Buffer . isBuffer ( data ) ) {
489+ return data ;
490+ }
487491 }
488492 throw new TypeError ( 'malformed file data' ) ;
489493 } ) . then ( data => {
You can’t perform that action at this time.
0 commit comments