aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/custom-validators/misc.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/helpers/custom-validators/misc.ts')
-rw-r--r--server/helpers/custom-validators/misc.ts4
1 files changed, 2 insertions, 2 deletions
diff --git a/server/helpers/custom-validators/misc.ts b/server/helpers/custom-validators/misc.ts
index 151fc852b..6d10a65a8 100644
--- a/server/helpers/custom-validators/misc.ts
+++ b/server/helpers/custom-validators/misc.ts
@@ -51,7 +51,7 @@ function isFileValid (
51 files: { [ fieldname: string ]: Express.Multer.File[] } | Express.Multer.File[], 51 files: { [ fieldname: string ]: Express.Multer.File[] } | Express.Multer.File[],
52 mimeTypeRegex: string, 52 mimeTypeRegex: string,
53 field: string, 53 field: string,
54 maxSize: number, 54 maxSize: number | null,
55 optional = false 55 optional = false
56) { 56) {
57 // Should have files 57 // Should have files
@@ -69,7 +69,7 @@ function isFileValid (
69 if (!file || !file.originalname) return false 69 if (!file || !file.originalname) return false
70 70
71 // Check size 71 // Check size
72 if (maxSize && file.size > maxSize) return false 72 if ((maxSize !== null) && file.size > maxSize) return false
73 73
74 return new RegExp(`^${mimeTypeRegex}$`, 'i').test(file.mimetype) 74 return new RegExp(`^${mimeTypeRegex}$`, 'i').test(file.mimetype)
75} 75}