]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/middlewares/validators/users.ts
Fix images size limit
[github/Chocobozzz/PeerTube.git] / server / middlewares / validators / users.ts
index 8fbab4dd049226217894d3674ce04fd707c8ca7b..55a08a64800dd822cc7ced26d42c6b336b059b5d 100644 (file)
@@ -118,7 +118,7 @@ const usersUpdateMeValidator = [
 
 const usersUpdateMyAvatarValidator = [
   body('avatarfile').custom((value, { req }) => isAvatarFile(req.files)).withMessage(
-    'This file is not supported. Please, make sure it is of the following type : '
+    'This file is not supported or too large. Please, make sure it is of the following type : '
     + CONSTRAINTS_FIELDS.ACTORS.AVATAR.EXTNAME.join(', ')
   ),
 
@@ -127,14 +127,6 @@ const usersUpdateMyAvatarValidator = [
 
     if (areValidationErrors(req, res)) return
 
-    const imageFile = req.files['avatarfile'][0] as Express.Multer.File
-    if (imageFile.size > CONSTRAINTS_FIELDS.ACTORS.AVATAR.FILE_SIZE.max) {
-      res.status(400)
-        .send({ error: `The size of the avatar is too big (>${CONSTRAINTS_FIELDS.ACTORS.AVATAR.FILE_SIZE.max}).` })
-        .end()
-      return
-    }
-
     return next()
   }
 ]