File tree 2 files changed +25
-3
lines changed
2 files changed +25
-3
lines changed Original file line number Diff line number Diff line change @@ -348,6 +348,12 @@ plugins.connectToAllDatabases().then(function() {
348
348
req . body += data ;
349
349
} ) ;
350
350
351
+ let multiFormData = false ;
352
+ // Check if we have 'multipart/form-data'
353
+ if ( req . headers [ 'content-type' ] ?. startsWith ( 'multipart/form-data' ) ) {
354
+ multiFormData = true ;
355
+ }
356
+
351
357
form . parse ( req , ( err , fields , files ) => {
352
358
//handle bakcwards compatability with formiddble v1
353
359
for ( let i in files ) {
@@ -362,8 +368,18 @@ plugins.connectToAllDatabases().then(function() {
362
368
}
363
369
}
364
370
params . files = files ;
365
- for ( const i in fields ) {
366
- params . qstring [ i ] = fields [ i ] ;
371
+ if ( multiFormData ) {
372
+ let formDataUrl = [ ] ;
373
+ for ( const i in fields ) {
374
+ params . qstring [ i ] = fields [ i ] ;
375
+ formDataUrl . push ( `${ i } =${ fields [ i ] } ` ) ;
376
+ }
377
+ params . formDataUrl = formDataUrl . join ( '&' ) ;
378
+ }
379
+ else {
380
+ for ( const i in fields ) {
381
+ params . qstring [ i ] = fields [ i ] ;
382
+ }
367
383
}
368
384
if ( ! params . apiPath ) {
369
385
processRequest ( params ) ;
Original file line number Diff line number Diff line change @@ -3098,7 +3098,13 @@ const checksumSaltVerification = (params) => {
3098
3098
payloads . push ( params . href . substr ( params . fullPath . length + 1 ) ) ;
3099
3099
3100
3100
if ( params . req . method . toLowerCase ( ) === 'post' ) {
3101
- payloads . push ( params . req . body ) ;
3101
+ // Check if we have 'multipart/form-data'
3102
+ if ( params . formDataUrl ) {
3103
+ payloads . push ( params . formDataUrl ) ;
3104
+ }
3105
+ else {
3106
+ payloads . push ( params . req . body ) ;
3107
+ }
3102
3108
}
3103
3109
if ( typeof params . qstring . checksum !== "undefined" ) {
3104
3110
for ( let i = 0 ; i < payloads . length ; i ++ ) {
You can’t perform that action at this time.
0 commit comments