@maioradv/nestjs-core 1.9.7 → 1.9.8
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const DEFAULT_MAX_IMAGE_SIZE = 10;
|
|
2
|
-
export declare const DEFAULT_MIMETYPES_SUPPORT
|
|
2
|
+
export declare const DEFAULT_MIMETYPES_SUPPORT: RegExp;
|
|
3
3
|
export type ImagePipeValidatorOptions = {
|
|
4
4
|
maxSize?: number;
|
|
5
5
|
mimeTypes?: ('webp' | 'avif' | 'png' | 'gif' | 'jpeg' | 'jpg')[];
|
|
@@ -4,11 +4,11 @@ exports.ImagePipeValidator = exports.DEFAULT_MIMETYPES_SUPPORT = exports.DEFAULT
|
|
|
4
4
|
const common_1 = require("@nestjs/common");
|
|
5
5
|
exports.DEFAULT_MAX_IMAGE_SIZE = 10;
|
|
6
6
|
//heic uploaded as application/octet-stream
|
|
7
|
-
exports.DEFAULT_MIMETYPES_SUPPORT =
|
|
7
|
+
exports.DEFAULT_MIMETYPES_SUPPORT = /^image\/(webp|avif|png|gif|jpe?g)$/;
|
|
8
8
|
const ImagePipeValidator = (options) => new common_1.ParseFilePipeBuilder()
|
|
9
9
|
.addFileTypeValidator({
|
|
10
|
-
fileType: options?.mimeTypes ?
|
|
11
|
-
skipMagicNumbersValidation: true
|
|
10
|
+
fileType: options?.mimeTypes ? new RegExp(`^image\\/(${options.mimeTypes.join("|")})$`) : exports.DEFAULT_MIMETYPES_SUPPORT,
|
|
11
|
+
//skipMagicNumbersValidation: true
|
|
12
12
|
})
|
|
13
13
|
.addMaxSizeValidator({
|
|
14
14
|
maxSize: (options?.maxSize ?? exports.DEFAULT_MAX_IMAGE_SIZE) * 1e6
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maioradv/nestjs-core",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.8",
|
|
4
4
|
"description": "NestJS helpers by MaiorADV",
|
|
5
5
|
"repository": "https://github.com/maioradv/nestjs-core.git",
|
|
6
6
|
"author": "Maior ADV Srl",
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
"bcrypt": "^6.0.0",
|
|
31
31
|
"class-transformer": "^0.5.1",
|
|
32
32
|
"class-validator": "^0.14.2",
|
|
33
|
+
"file-type": "^20.5.0",
|
|
33
34
|
"handlebars": "^4.7.8",
|
|
34
35
|
"image-size": "^2.0.2",
|
|
35
36
|
"nest-winston": "^1.10.2",
|