expressjs / multer

Node.js middleware for handling `multipart/form-data`.
MIT License
11.55k stars 1.05k forks source link

Multer skips the request, when boundary contains an equal sign "=" #1051

Open tanakom-truevoice opened 2 years ago

tanakom-truevoice commented 2 years ago

https://github.com/expressjs/multer/blob/dd3ecef8dcac79568b96313dca00adad7563b45d/lib/make-middleware.js#L18

type-is use media-typer which treats the equal sign "=" as a separator (RFC 2616 sec 3.7). However, in the RFC 2046 Page 21 the boundary value is allows to use the equal sign "=".

So, when the boundary contains the equal sign "=", Multer will always skip the request.

tanakom-truevoice commented 2 years ago

The sample of boundary that is not working is

'multipart/form-data; boundary=yradnuoB=_00102021041678916.vgthbatel-03abc.xyz'

hakudev commented 2 years ago

Have you tried putting your boundary value inside quotes?

E. g. 'multipart/form-data; boundary="yradnuoB=_00102021041678916.vgthbatel-03abc.xyz"' Other than that, see RFC 2049 for an example of nested "multipart" entities.

I'd also assume your nested multipart entity would require to use a different boundary delimiter, so I'm not sure if this is a bug or just a mere misunderstanding..