aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/validators/actor-image.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/middlewares/validators/actor-image.ts')
-rw-r--r--server/middlewares/validators/actor-image.ts27
1 files changed, 0 insertions, 27 deletions
diff --git a/server/middlewares/validators/actor-image.ts b/server/middlewares/validators/actor-image.ts
deleted file mode 100644
index 9dcf5e871..000000000
--- a/server/middlewares/validators/actor-image.ts
+++ /dev/null
@@ -1,27 +0,0 @@
1import express from 'express'
2import { body } from 'express-validator'
3import { isActorImageFile } from '@server/helpers/custom-validators/actor-images'
4import { cleanUpReqFiles } from '../../helpers/express-utils'
5import { CONSTRAINTS_FIELDS } from '../../initializers/constants'
6import { areValidationErrors } from './shared'
7
8const updateActorImageValidatorFactory = (fieldname: string) => ([
9 body(fieldname).custom((value, { req }) => isActorImageFile(req.files, fieldname)).withMessage(
10 'This file is not supported or too large. Please, make sure it is of the following type : ' +
11 CONSTRAINTS_FIELDS.ACTORS.IMAGE.EXTNAME.join(', ')
12 ),
13
14 (req: express.Request, res: express.Response, next: express.NextFunction) => {
15 if (areValidationErrors(req, res)) return cleanUpReqFiles(req)
16
17 return next()
18 }
19])
20
21const updateAvatarValidator = updateActorImageValidatorFactory('avatarfile')
22const updateBannerValidator = updateActorImageValidatorFactory('bannerfile')
23
24export {
25 updateAvatarValidator,
26 updateBannerValidator
27}