aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares
diff options
context:
space:
mode:
Diffstat (limited to 'server/middlewares')
-rw-r--r--server/middlewares/validators/videos.ts21
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
255function 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
274function areErrorsInScheduleUpdate (req: express.Request, res: express.Response) { 253function 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) {