Cleanup
This commit is contained in:
5
node_modules/multer/lib/make-middleware.js
generated
vendored
5
node_modules/multer/lib/make-middleware.js
generated
vendored
@@ -81,11 +81,12 @@ function makeMiddleware (setup) {
|
||||
|
||||
// handle text field data
|
||||
busboy.on('field', function (fieldname, value, fieldnameTruncated, valueTruncated) {
|
||||
if (fieldname == null) return abortWithCode('MISSING_FIELD_NAME')
|
||||
if (fieldnameTruncated) return abortWithCode('LIMIT_FIELD_KEY')
|
||||
if (valueTruncated) return abortWithCode('LIMIT_FIELD_VALUE', fieldname)
|
||||
|
||||
// Work around bug in Busboy (https://github.com/mscdex/busboy/issues/6)
|
||||
if (limits && limits.hasOwnProperty('fieldNameSize')) {
|
||||
if (limits && Object.prototype.hasOwnProperty.call(limits, 'fieldNameSize')) {
|
||||
if (fieldname.length > limits.fieldNameSize) return abortWithCode('LIMIT_FIELD_KEY')
|
||||
}
|
||||
|
||||
@@ -98,7 +99,7 @@ function makeMiddleware (setup) {
|
||||
if (!filename) return fileStream.resume()
|
||||
|
||||
// Work around bug in Busboy (https://github.com/mscdex/busboy/issues/6)
|
||||
if (limits && limits.hasOwnProperty('fieldNameSize')) {
|
||||
if (limits && Object.prototype.hasOwnProperty.call(limits, 'fieldNameSize')) {
|
||||
if (fieldname.length > limits.fieldNameSize) return abortWithCode('LIMIT_FIELD_KEY')
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user