diff options
Diffstat (limited to 'server/middlewares/validators/avatar.ts')
-rw-r--r-- | server/middlewares/validators/avatar.ts | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/server/middlewares/validators/avatar.ts b/server/middlewares/validators/avatar.ts deleted file mode 100644 index 2acb97483..000000000 --- a/server/middlewares/validators/avatar.ts +++ /dev/null | |||
@@ -1,26 +0,0 @@ | |||
1 | import * as express from 'express' | ||
2 | import { body } from 'express-validator' | ||
3 | import { isAvatarFile } from '../../helpers/custom-validators/users' | ||
4 | import { areValidationErrors } from './utils' | ||
5 | import { CONSTRAINTS_FIELDS } from '../../initializers/constants' | ||
6 | import { logger } from '../../helpers/logger' | ||
7 | import { cleanUpReqFiles } from '../../helpers/express-utils' | ||
8 | |||
9 | const updateAvatarValidator = [ | ||
10 | body('avatarfile').custom((value, { req }) => isAvatarFile(req.files)).withMessage( | ||
11 | 'This file is not supported or too large. Please, make sure it is of the following type : ' + | ||
12 | CONSTRAINTS_FIELDS.ACTORS.AVATAR.EXTNAME.join(', ') | ||
13 | ), | ||
14 | |||
15 | (req: express.Request, res: express.Response, next: express.NextFunction) => { | ||
16 | logger.debug('Checking updateAvatarValidator parameters', { files: req.files }) | ||
17 | |||
18 | if (areValidationErrors(req, res)) return cleanUpReqFiles(req) | ||
19 | |||
20 | return next() | ||
21 | } | ||
22 | ] | ||
23 | |||
24 | export { | ||
25 | updateAvatarValidator | ||
26 | } | ||