diff options
author | Chocobozzz <me@florianbigard.com> | 2021-04-07 10:36:13 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2021-04-08 10:07:53 +0200 |
commit | 213e30ef90806369529684ac9c247d73b8dc7928 (patch) | |
tree | 7f834f2485a074b1d3052745fa5236d34c0f26db /server/middlewares/validators | |
parent | 2cb03dc1f4e01ba491c36caff30c33fe9c5bad89 (diff) | |
download | PeerTube-213e30ef90806369529684ac9c247d73b8dc7928.tar.gz PeerTube-213e30ef90806369529684ac9c247d73b8dc7928.tar.zst PeerTube-213e30ef90806369529684ac9c247d73b8dc7928.zip |
Add banner tests
Diffstat (limited to 'server/middlewares/validators')
-rw-r--r-- | server/middlewares/validators/actor-image.ts (renamed from server/middlewares/validators/avatar.ts) | 10 | ||||
-rw-r--r-- | server/middlewares/validators/index.ts | 1 |
2 files changed, 6 insertions, 5 deletions
diff --git a/server/middlewares/validators/avatar.ts b/server/middlewares/validators/actor-image.ts index f7eb367bd..961d7a7e5 100644 --- a/server/middlewares/validators/avatar.ts +++ b/server/middlewares/validators/actor-image.ts | |||
@@ -1,13 +1,13 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { body } from 'express-validator' | 2 | import { body } from 'express-validator' |
3 | import { isAvatarFile } from '../../helpers/custom-validators/users' | 3 | import { isActorImageFile } from '@server/helpers/custom-validators/actor-images' |
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' | 4 | import { cleanUpReqFiles } from '../../helpers/express-utils' |
5 | import { logger } from '../../helpers/logger' | ||
6 | import { CONSTRAINTS_FIELDS } from '../../initializers/constants' | ||
7 | import { areValidationErrors } from './utils' | ||
8 | 8 | ||
9 | const updateActorImageValidatorFactory = (fieldname: string) => ([ | 9 | const updateActorImageValidatorFactory = (fieldname: string) => ([ |
10 | body(fieldname).custom((value, { req }) => isAvatarFile(req.files)).withMessage( | 10 | body(fieldname).custom((value, { req }) => isActorImageFile(req.files, fieldname)).withMessage( |
11 | 'This file is not supported or too large. Please, make sure it is of the following type : ' + | 11 | 'This file is not supported or too large. Please, make sure it is of the following type : ' + |
12 | CONSTRAINTS_FIELDS.ACTORS.IMAGE.EXTNAME.join(', ') | 12 | CONSTRAINTS_FIELDS.ACTORS.IMAGE.EXTNAME.join(', ') |
13 | ), | 13 | ), |
diff --git a/server/middlewares/validators/index.ts b/server/middlewares/validators/index.ts index 4086d77aa..24faeea3e 100644 --- a/server/middlewares/validators/index.ts +++ b/server/middlewares/validators/index.ts | |||
@@ -1,5 +1,6 @@ | |||
1 | export * from './abuse' | 1 | export * from './abuse' |
2 | export * from './account' | 2 | export * from './account' |
3 | export * from './actor-image' | ||
3 | export * from './blocklist' | 4 | export * from './blocklist' |
4 | export * from './oembed' | 5 | export * from './oembed' |
5 | export * from './activitypub' | 6 | export * from './activitypub' |