@nestjs/platform-express 11.2.4 → 11.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -9,7 +9,7 @@ exports.multerExceptions = {
|
|
|
9
9
|
LIMIT_FIELD_KEY: 'Field name too long',
|
|
10
10
|
LIMIT_FIELD_VALUE: 'Field value too long',
|
|
11
11
|
LIMIT_FIELD_COUNT: 'Too many fields',
|
|
12
|
-
LIMIT_UNEXPECTED_FILE: 'Unexpected field',
|
|
12
|
+
LIMIT_UNEXPECTED_FILE: 'Unexpected file field',
|
|
13
13
|
MISSING_FIELD_NAME: 'Field name missing',
|
|
14
14
|
LIMIT_FIELD_NESTING: 'Field name nesting too deep',
|
|
15
15
|
};
|
|
@@ -9,7 +9,12 @@ function transformException(error) {
|
|
|
9
9
|
if (!error || error instanceof common_1.HttpException) {
|
|
10
10
|
return error;
|
|
11
11
|
}
|
|
12
|
-
|
|
12
|
+
// Multer identifies its errors by `code`, while the messages may change
|
|
13
|
+
// between releases (e.g. "Unexpected field" became "Unexpected file field")
|
|
14
|
+
const exception = isMulterExceptionCode(error.code)
|
|
15
|
+
? multer_constants_1.multerExceptions[error.code]
|
|
16
|
+
: error.message;
|
|
17
|
+
switch (exception) {
|
|
13
18
|
case multer_constants_1.multerExceptions.LIMIT_FILE_SIZE:
|
|
14
19
|
return new common_1.PayloadTooLargeException(error.message);
|
|
15
20
|
case multer_constants_1.multerExceptions.LIMIT_FILE_COUNT:
|
|
@@ -33,3 +38,7 @@ function transformException(error) {
|
|
|
33
38
|
}
|
|
34
39
|
return error;
|
|
35
40
|
}
|
|
41
|
+
function isMulterExceptionCode(code) {
|
|
42
|
+
return (typeof code === 'string' &&
|
|
43
|
+
Object.prototype.hasOwnProperty.call(multer_constants_1.multerExceptions, code));
|
|
44
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nestjs/platform-express",
|
|
3
|
-
"version": "11.2.
|
|
3
|
+
"version": "11.2.6",
|
|
4
4
|
"description": "Nest - modern, fast, powerful node.js web framework (@platform-express)",
|
|
5
5
|
"author": "Kamil Mysliwiec",
|
|
6
6
|
"license": "MIT",
|
|
@@ -20,17 +20,17 @@
|
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"cors": "2.8.6",
|
|
22
22
|
"express": "5.2.1",
|
|
23
|
-
"multer": "2.
|
|
23
|
+
"multer": "2.4.0",
|
|
24
24
|
"path-to-regexp": "8.4.2",
|
|
25
25
|
"tslib": "2.8.1"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@nestjs/common": "11.2.
|
|
29
|
-
"@nestjs/core": "11.2.
|
|
28
|
+
"@nestjs/common": "11.2.6",
|
|
29
|
+
"@nestjs/core": "11.2.6"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
32
|
"@nestjs/common": "^11.0.0",
|
|
33
33
|
"@nestjs/core": "^11.0.0"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "c07cfb0be5e95ffa129da39ccc49a23cb64d49ff"
|
|
36
36
|
}
|