Skip to content

Commit 78a66c1

Browse files
Merge pull request #315 from duterte/master
Upgrade busboy version
2 parents ce713c2 + 310a382 commit 78a66c1

File tree

4 files changed

+583
-546
lines changed

4 files changed

+583
-546
lines changed

lib/processMultipart.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ module.exports = (options, req, res, next) => {
2929

3030
// Build busboy options and init busboy instance.
3131
const busboyOptions = buildOptions(options, { headers: req.headers });
32-
const busboy = new Busboy(busboyOptions);
32+
const busboy = Busboy(busboyOptions);
3333

3434
// Close connection with specified reason and http code, default: 400 Bad Request.
3535
const closeConnection = (code, reason) => {
@@ -46,8 +46,9 @@ module.exports = (options, req, res, next) => {
4646
busboy.on('field', (field, val) => req.body = buildFields(req.body, field, val));
4747

4848
// Build req.files fields
49-
busboy.on('file', (field, file, name, encoding, mime) => {
49+
busboy.on('file', (field, file, info) => {
5050
// Parse file name(cutting huge names, decoding, etc..).
51+
const {filename:name, encoding, mimeType: mime} = info;
5152
const filename = parseFileName(options, name);
5253
// Define methods and handlers for upload process.
5354
const {

0 commit comments

Comments
 (0)