diff options
Diffstat (limited to 'server/middlewares/validators/avatar.ts')
-rw-r--r-- | server/middlewares/validators/avatar.ts | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/server/middlewares/validators/avatar.ts b/server/middlewares/validators/avatar.ts index f346ea92f..5860735c6 100644 --- a/server/middlewares/validators/avatar.ts +++ b/server/middlewares/validators/avatar.ts | |||
@@ -4,6 +4,7 @@ import { isAvatarFile } from '../../helpers/custom-validators/users' | |||
4 | import { areValidationErrors } from './utils' | 4 | import { areValidationErrors } from './utils' |
5 | import { CONSTRAINTS_FIELDS } from '../../initializers' | 5 | import { CONSTRAINTS_FIELDS } from '../../initializers' |
6 | import { logger } from '../../helpers/logger' | 6 | import { logger } from '../../helpers/logger' |
7 | import { cleanUpReqFiles } from '../../helpers/utils' | ||
7 | 8 | ||
8 | const updateAvatarValidator = [ | 9 | const updateAvatarValidator = [ |
9 | body('avatarfile').custom((value, { req }) => isAvatarFile(req.files)).withMessage( | 10 | body('avatarfile').custom((value, { req }) => isAvatarFile(req.files)).withMessage( |
@@ -14,7 +15,7 @@ const updateAvatarValidator = [ | |||
14 | (req: express.Request, res: express.Response, next: express.NextFunction) => { | 15 | (req: express.Request, res: express.Response, next: express.NextFunction) => { |
15 | logger.debug('Checking updateAvatarValidator parameters', { files: req.files }) | 16 | logger.debug('Checking updateAvatarValidator parameters', { files: req.files }) |
16 | 17 | ||
17 | if (areValidationErrors(req, res)) return | 18 | if (areValidationErrors(req, res)) return cleanUpReqFiles(req) |
18 | 19 | ||
19 | return next() | 20 | return next() |
20 | } | 21 | } |