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')
|
||||
}
|
||||
|
||||
|
||||
15
node_modules/multer/lib/multer-error.js
generated
vendored
15
node_modules/multer/lib/multer-error.js
generated
vendored
@@ -1,13 +1,14 @@
|
||||
var util = require('util')
|
||||
|
||||
var errorMessages = {
|
||||
'LIMIT_PART_COUNT': 'Too many parts',
|
||||
'LIMIT_FILE_SIZE': 'File too large',
|
||||
'LIMIT_FILE_COUNT': 'Too many files',
|
||||
'LIMIT_FIELD_KEY': 'Field name too long',
|
||||
'LIMIT_FIELD_VALUE': 'Field value too long',
|
||||
'LIMIT_FIELD_COUNT': 'Too many fields',
|
||||
'LIMIT_UNEXPECTED_FILE': 'Unexpected field'
|
||||
LIMIT_PART_COUNT: 'Too many parts',
|
||||
LIMIT_FILE_SIZE: 'File too large',
|
||||
LIMIT_FILE_COUNT: 'Too many files',
|
||||
LIMIT_FIELD_KEY: 'Field name too long',
|
||||
LIMIT_FIELD_VALUE: 'Field value too long',
|
||||
LIMIT_FIELD_COUNT: 'Too many fields',
|
||||
LIMIT_UNEXPECTED_FILE: 'Unexpected field',
|
||||
MISSING_FIELD_NAME: 'Field name missing'
|
||||
}
|
||||
|
||||
function MulterError (code, field) {
|
||||
|
||||
Reference in New Issue
Block a user