commit
e76d571a8c
|
@ -52,9 +52,11 @@ exports.upload = function(provider, req, res, options, cb) {
|
|||
self._fieldsSize += buffer.length;
|
||||
if (self._fieldsSize > self.maxFieldsSize) {
|
||||
self._error(new Error(
|
||||
g.f('{{maxFieldsSize}} exceeded, received %s bytes of field data',
|
||||
g.f(
|
||||
'{{maxFieldsSize}} exceeded, received %s bytes of field data',
|
||||
self._fieldsSize
|
||||
)));
|
||||
)
|
||||
));
|
||||
return;
|
||||
}
|
||||
value += decoder.write(buffer);
|
||||
|
@ -104,10 +106,12 @@ exports.upload = function(provider, req, res, options, cb) {
|
|||
if (Array.isArray(allowedContentTypes) && allowedContentTypes.length !== 0) {
|
||||
if (allowedContentTypes.indexOf(file.type) === -1) {
|
||||
self._error(new Error(
|
||||
g.f('{{contentType}} "%s" is not allowed (Must be in [%s])',
|
||||
g.f(
|
||||
'{{contentType}} "%s" is not allowed (Must be in [%s])',
|
||||
file.type,
|
||||
allowedContentTypes.join(', ')
|
||||
)));
|
||||
)
|
||||
));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -203,10 +207,12 @@ exports.upload = function(provider, req, res, options, cb) {
|
|||
// - s3-upload-stream doesn't provide a way to do this in it's public interface
|
||||
// - We could call provider.delete file but it would not delete multipart data
|
||||
self._error(new Error(
|
||||
g.f('{{maxFileSize}} exceeded, received %s bytes of field data (max is %s)',
|
||||
g.f(
|
||||
'{{maxFileSize}} exceeded, received %s bytes of field data (max is %s)',
|
||||
fileSize,
|
||||
maxFileSize
|
||||
)));
|
||||
)
|
||||
));
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
|
|
@ -20,10 +20,10 @@
|
|||
"uuid": "^3.2.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint": "^4.19.1",
|
||||
"eslint-config-loopback": "^10.0.0",
|
||||
"eslint": "^5.4.0",
|
||||
"eslint-config-loopback": "^11.0.0",
|
||||
"express": "^4.16.3",
|
||||
"loopback": "^3.20.0",
|
||||
"loopback": "^3.22.1",
|
||||
"mkdirp": "^0.5.1",
|
||||
"mocha": "^5.2.0",
|
||||
"supertest": "^3.1.0",
|
||||
|
|
Loading…
Reference in New Issue