diff options
author | Chocobozzz <me@florianbigard.com> | 2018-07-16 16:51:17 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-07-16 16:51:17 +0200 |
commit | 019e47507212072a7b91fb18dd31b4170d9cb40c (patch) | |
tree | 9ea9c7d15b8f22fe769fd32747a3c662e58cbaa3 /server | |
parent | 1f6824c958440ace14f7c7f83c890b848a71f5d9 (diff) | |
download | PeerTube-019e47507212072a7b91fb18dd31b4170d9cb40c.tar.gz PeerTube-019e47507212072a7b91fb18dd31b4170d9cb40c.tar.zst PeerTube-019e47507212072a7b91fb18dd31b4170d9cb40c.zip |
Remove unnecessary image check in video upload
Diffstat (limited to 'server')
-rw-r--r-- | server/middlewares/validators/videos.ts | 21 |
1 files changed, 0 insertions, 21 deletions
diff --git a/server/middlewares/validators/videos.ts b/server/middlewares/validators/videos.ts index a2f64ef8f..abb23b510 100644 --- a/server/middlewares/validators/videos.ts +++ b/server/middlewares/validators/videos.ts | |||
@@ -51,7 +51,6 @@ const videosAddValidator = getCommonVideoAttributes().concat([ | |||
51 | logger.debug('Checking videosAdd parameters', { parameters: req.body, files: req.files }) | 51 | logger.debug('Checking videosAdd parameters', { parameters: req.body, files: req.files }) |
52 | 52 | ||
53 | if (areValidationErrors(req, res)) return | 53 | if (areValidationErrors(req, res)) return |
54 | if (areErrorsInVideoImageFiles(req, res)) return | ||
55 | if (areErrorsInScheduleUpdate(req, res)) return | 54 | if (areErrorsInScheduleUpdate(req, res)) return |
56 | 55 | ||
57 | const videoFile: Express.Multer.File = req.files['videofile'][0] | 56 | const videoFile: Express.Multer.File = req.files['videofile'][0] |
@@ -101,7 +100,6 @@ const videosUpdateValidator = getCommonVideoAttributes().concat([ | |||
101 | logger.debug('Checking videosUpdate parameters', { parameters: req.body }) | 100 | logger.debug('Checking videosUpdate parameters', { parameters: req.body }) |
102 | 101 | ||
103 | if (areValidationErrors(req, res)) return | 102 | if (areValidationErrors(req, res)) return |
104 | if (areErrorsInVideoImageFiles(req, res)) return | ||
105 | if (areErrorsInScheduleUpdate(req, res)) return | 103 | if (areErrorsInScheduleUpdate(req, res)) return |
106 | if (!await isVideoExist(req.params.id, res)) return | 104 | if (!await isVideoExist(req.params.id, res)) return |
107 | 105 | ||
@@ -252,25 +250,6 @@ export { | |||
252 | 250 | ||
253 | // --------------------------------------------------------------------------- | 251 | // --------------------------------------------------------------------------- |
254 | 252 | ||
255 | function areErrorsInVideoImageFiles (req: express.Request, res: express.Response) { | ||
256 | // Files are optional | ||
257 | if (!req.files) return false | ||
258 | |||
259 | for (const imageField of [ 'thumbnail', 'preview' ]) { | ||
260 | if (!req.files[ imageField ]) continue | ||
261 | |||
262 | const imageFile = req.files[ imageField ][ 0 ] as Express.Multer.File | ||
263 | if (imageFile.size > CONSTRAINTS_FIELDS.VIDEOS.IMAGE.FILE_SIZE.max) { | ||
264 | res.status(400) | ||
265 | .json({ error: `The size of the ${imageField} is too big (>${CONSTRAINTS_FIELDS.VIDEOS.IMAGE.FILE_SIZE.max}).` }) | ||
266 | .end() | ||
267 | return true | ||
268 | } | ||
269 | } | ||
270 | |||
271 | return false | ||
272 | } | ||
273 | |||
274 | function areErrorsInScheduleUpdate (req: express.Request, res: express.Response) { | 253 | function areErrorsInScheduleUpdate (req: express.Request, res: express.Response) { |
275 | if (req.body.scheduleUpdate) { | 254 | if (req.body.scheduleUpdate) { |
276 | if (!req.body.scheduleUpdate.updateAt) { | 255 | if (!req.body.scheduleUpdate.updateAt) { |