Skip to content

Commit

Permalink
Merge pull request #315 from duterte/master
Browse files Browse the repository at this point in the history
Upgrade busboy version
  • Loading branch information
richardgirges authored May 24, 2022
2 parents ce713c2 + 310a382 commit 78a66c1
Show file tree
Hide file tree
Showing 4 changed files with 583 additions and 546 deletions.
5 changes: 3 additions & 2 deletions lib/processMultipart.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ module.exports = (options, req, res, next) => {

// Build busboy options and init busboy instance.
const busboyOptions = buildOptions(options, { headers: req.headers });
const busboy = new Busboy(busboyOptions);
const busboy = Busboy(busboyOptions);

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

// Build req.files fields
busboy.on('file', (field, file, name, encoding, mime) => {
busboy.on('file', (field, file, info) => {
// Parse file name(cutting huge names, decoding, etc..).
const {filename:name, encoding, mimeType: mime} = info;
const filename = parseFileName(options, name);
// Define methods and handlers for upload process.
const {
Expand Down
Loading

0 comments on commit 78a66c1

Please sign in to comment.