multer icon indicating copy to clipboard operation
multer copied to clipboard

Request body is null after upgrade from 1.4.4 to 1.4.5-lts.1

Open Alangus opened this issue 2 years ago • 5 comments

my request like this:

` POST http://localhost:8000/cos/uploadOneFile Content-Type: multipart/form-data; boundary=WebAppBoundary

--WebAppBoundary Content-Disposition: form-data; name="param1"; Content-Type: text/plain

abc --WebAppBoundary Content-Disposition: form-data; name="upload"; filename="event/test1.jpg" Content-Type: image/jpeg

< /root/test-00-04-49-489.jpg `

and I cannot get param1 from request body, and my code like this

router.post('/uploadOneFile', upload.single('upload'), (request, response) => { let { param1 } = request.body; }

Alangus avatar Jul 04 '22 08:07 Alangus

Hm, this seems to be because of a newer version of Busboy. Would you be able to reproduce your bug with that and file an issue in their repo?

LinusU avatar Jul 05 '22 14:07 LinusU

hi @Alangus , i just noticed the same problem. somehow the trailing semicolon is not allowed anymore. not sure if this could or should be fixed in busyboy, multer, or in your client.

Content-Disposition: form-data; name="param1";

buxit avatar Jul 06 '22 07:07 buxit

I have the same problem. Updated my Multer to 1.4.5-lts.1 and now every single request has an undefined request.file.

This is my Postman request (my Content-Type is multipart/form-data): image

This is my Postman console: image

My code and my results: image

image

Edit: hmmmmm I downgraded to 1.4.4 but I still have the same problem even that it was working before... Maybe there is something else. I also updated my mongoose to 6.6.1 from 6.5.2 in my last commit.

Edit 2: I tried to rollback everything I made in my API last week but I still get the same problem ):

NathanAP avatar Sep 26 '22 14:09 NathanAP

Sorry for the multiple edition and comment about this issue. My situation was about Multer not finding the right folder to upload my photo. 😅 Creating the folder in the right directory made it work again.

I'm not sure if this is mentioned on docs but it might be a good first issue!

NathanAP avatar Sep 26 '22 18:09 NathanAP

We are also experiencing the same problem, moving to 1.4.5-lts.1 causes the files array to be empty. This is definitely due to the fact that the content-disposition line has a trailing semi-colon, which busboy no longer supports. Unfortunately we're receiving data from a source we do not control, so no option to change that. I can't seem to find why this is now the case, busboy went through a significant rewrite....

chriswiggins avatar Nov 22 '22 01:11 chriswiggins