aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/validators/users.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-06-22 15:42:55 +0200
committerChocobozzz <me@florianbigard.com>2018-06-22 15:42:55 +0200
commit0c237b19fdf9c614293c1442f0ab95a81ce05735 (patch)
tree81f7ae4262630da5e8041bd70e2cb856e48253a3 /server/middlewares/validators/users.ts
parentc4082b8b4e3684baae0172e97297c936d7419f2c (diff)
downloadPeerTube-0c237b19fdf9c614293c1442f0ab95a81ce05735.tar.gz
PeerTube-0c237b19fdf9c614293c1442f0ab95a81ce05735.tar.zst
PeerTube-0c237b19fdf9c614293c1442f0ab95a81ce05735.zip
Fix images size limit
Diffstat (limited to 'server/middlewares/validators/users.ts')
-rw-r--r--server/middlewares/validators/users.ts10
1 files changed, 1 insertions, 9 deletions
diff --git a/server/middlewares/validators/users.ts b/server/middlewares/validators/users.ts
index 8fbab4dd0..55a08a648 100644
--- a/server/middlewares/validators/users.ts
+++ b/server/middlewares/validators/users.ts
@@ -118,7 +118,7 @@ const usersUpdateMeValidator = [
118 118
119const usersUpdateMyAvatarValidator = [ 119const usersUpdateMyAvatarValidator = [
120 body('avatarfile').custom((value, { req }) => isAvatarFile(req.files)).withMessage( 120 body('avatarfile').custom((value, { req }) => isAvatarFile(req.files)).withMessage(
121 'This file is not supported. Please, make sure it is of the following type : ' 121 'This file is not supported or too large. Please, make sure it is of the following type : '
122 + CONSTRAINTS_FIELDS.ACTORS.AVATAR.EXTNAME.join(', ') 122 + CONSTRAINTS_FIELDS.ACTORS.AVATAR.EXTNAME.join(', ')
123 ), 123 ),
124 124
@@ -127,14 +127,6 @@ const usersUpdateMyAvatarValidator = [
127 127
128 if (areValidationErrors(req, res)) return 128 if (areValidationErrors(req, res)) return
129 129
130 const imageFile = req.files['avatarfile'][0] as Express.Multer.File
131 if (imageFile.size > CONSTRAINTS_FIELDS.ACTORS.AVATAR.FILE_SIZE.max) {
132 res.status(400)
133 .send({ error: `The size of the avatar is too big (>${CONSTRAINTS_FIELDS.ACTORS.AVATAR.FILE_SIZE.max}).` })
134 .end()
135 return
136 }
137
138 return next() 130 return next()
139 } 131 }
140] 132]