diff options
Diffstat (limited to 'server/middlewares/validators/users.ts')
-rw-r--r-- | server/middlewares/validators/users.ts | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/server/middlewares/validators/users.ts b/server/middlewares/validators/users.ts index 8fbab4dd0..55a08a648 100644 --- a/server/middlewares/validators/users.ts +++ b/server/middlewares/validators/users.ts | |||
@@ -118,7 +118,7 @@ const usersUpdateMeValidator = [ | |||
118 | 118 | ||
119 | const usersUpdateMyAvatarValidator = [ | 119 | const usersUpdateMyAvatarValidator = [ |
120 | body('avatarfile').custom((value, { req }) => isAvatarFile(req.files)).withMessage( | 120 | body('avatarfile').custom((value, { req }) => isAvatarFile(req.files)).withMessage( |
121 | 'This file is not supported. Please, make sure it is of the following type : ' | 121 | 'This file is not supported or too large. Please, make sure it is of the following type : ' |
122 | + CONSTRAINTS_FIELDS.ACTORS.AVATAR.EXTNAME.join(', ') | 122 | + CONSTRAINTS_FIELDS.ACTORS.AVATAR.EXTNAME.join(', ') |
123 | ), | 123 | ), |
124 | 124 | ||
@@ -127,14 +127,6 @@ const usersUpdateMyAvatarValidator = [ | |||
127 | 127 | ||
128 | if (areValidationErrors(req, res)) return | 128 | if (areValidationErrors(req, res)) return |
129 | 129 | ||
130 | const imageFile = req.files['avatarfile'][0] as Express.Multer.File | ||
131 | if (imageFile.size > CONSTRAINTS_FIELDS.ACTORS.AVATAR.FILE_SIZE.max) { | ||
132 | res.status(400) | ||
133 | .send({ error: `The size of the avatar is too big (>${CONSTRAINTS_FIELDS.ACTORS.AVATAR.FILE_SIZE.max}).` }) | ||
134 | .end() | ||
135 | return | ||
136 | } | ||
137 | |||
138 | return next() | 130 | return next() |
139 | } | 131 | } |
140 | ] | 132 | ] |