mscdex/busboy

Busboy does not recognize `image/jpeg` without `filename` as files

MegaSpaceHamlet opened this issue · 1 comments

When using Multer, which wraps around Busboy, the req.files property will populate with all files registered from Busboy.

When using a new software that sends multipart/form-data types, the image/jpeg parts would come into the req.body (fields) not req.files.

Upon tweaking the software to send a filename property with the image part, the images were recognized as files.

Why not add the type image/jpeg as a file type even if it doesn't have the filename property?

I'm happy to make a PR for this issue.

mscdex commented

The unfortunate thing is that within the relevant RFC(s) there is no hard differentiator between what is a file and what is a field. This module utilizes the traditional differentiators used by browsers over the past decades, which is either specifying a part content type of application/octet-stream and/or specifying a filename.

I'm not really interested in expanding the part content types used to detect "files" as it would just be arbitrary anyway (and thus not something I'd want to have to maintain) and potentially breaking for many people.

Just have your HTTP client send a filename (even if empty) or use application/octet-stream.