aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/validators/avatar.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-07-31 15:09:34 +0200
committerChocobozzz <me@florianbigard.com>2018-07-31 15:09:34 +0200
commitcf7a61b5a2b68fd966c4a355e37e84b048ed296b (patch)
tree4f4867344fe6856cb4f6b18856867c6e34171ea2 /server/middlewares/validators/avatar.ts
parentc487d3033cad9c5e0f85ae49ed3d2a7b6c2711d8 (diff)
downloadPeerTube-cf7a61b5a2b68fd966c4a355e37e84b048ed296b.tar.gz
PeerTube-cf7a61b5a2b68fd966c4a355e37e84b048ed296b.tar.zst
PeerTube-cf7a61b5a2b68fd966c4a355e37e84b048ed296b.zip
Cleanup req files on bad request
Diffstat (limited to 'server/middlewares/validators/avatar.ts')
-rw-r--r--server/middlewares/validators/avatar.ts3
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'
4import { areValidationErrors } from './utils' 4import { areValidationErrors } from './utils'
5import { CONSTRAINTS_FIELDS } from '../../initializers' 5import { CONSTRAINTS_FIELDS } from '../../initializers'
6import { logger } from '../../helpers/logger' 6import { logger } from '../../helpers/logger'
7import { cleanUpReqFiles } from '../../helpers/utils'
7 8
8const updateAvatarValidator = [ 9const 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 }