aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/validators/videos/video-files.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/middlewares/validators/videos/video-files.ts')
-rw-r--r--server/middlewares/validators/videos/video-files.ts13
1 files changed, 2 insertions, 11 deletions
diff --git a/server/middlewares/validators/videos/video-files.ts b/server/middlewares/validators/videos/video-files.ts
index b44c997e3..92c5b9483 100644
--- a/server/middlewares/validators/videos/video-files.ts
+++ b/server/middlewares/validators/videos/video-files.ts
@@ -1,17 +1,14 @@
1import express from 'express' 1import express from 'express'
2import { param } from 'express-validator'
3import { isIdValid } from '@server/helpers/custom-validators/misc'
2import { MVideo } from '@server/types/models' 4import { MVideo } from '@server/types/models'
3import { HttpStatusCode } from '@shared/models' 5import { HttpStatusCode } from '@shared/models'
4import { logger } from '../../../helpers/logger'
5import { areValidationErrors, doesVideoExist, isValidVideoIdParam } from '../shared' 6import { areValidationErrors, doesVideoExist, isValidVideoIdParam } from '../shared'
6import { isIdValid } from '@server/helpers/custom-validators/misc'
7import { param } from 'express-validator'
8 7
9const videoFilesDeleteWebTorrentValidator = [ 8const videoFilesDeleteWebTorrentValidator = [
10 isValidVideoIdParam('id'), 9 isValidVideoIdParam('id'),
11 10
12 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 11 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
13 logger.debug('Checking videoFilesDeleteWebTorrent parameters', { parameters: req.params })
14
15 if (areValidationErrors(req, res)) return 12 if (areValidationErrors(req, res)) return
16 if (!await doesVideoExist(req.params.id, res)) return 13 if (!await doesVideoExist(req.params.id, res)) return
17 14
@@ -44,8 +41,6 @@ const videoFilesDeleteWebTorrentFileValidator = [
44 .custom(isIdValid), 41 .custom(isIdValid),
45 42
46 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 43 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
47 logger.debug('Checking videoFilesDeleteWebTorrentFile parameters', { parameters: req.params })
48
49 if (areValidationErrors(req, res)) return 44 if (areValidationErrors(req, res)) return
50 if (!await doesVideoExist(req.params.id, res)) return 45 if (!await doesVideoExist(req.params.id, res)) return
51 46
@@ -78,8 +73,6 @@ const videoFilesDeleteHLSValidator = [
78 isValidVideoIdParam('id'), 73 isValidVideoIdParam('id'),
79 74
80 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 75 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
81 logger.debug('Checking videoFilesDeleteHLS parameters', { parameters: req.params })
82
83 if (areValidationErrors(req, res)) return 76 if (areValidationErrors(req, res)) return
84 if (!await doesVideoExist(req.params.id, res)) return 77 if (!await doesVideoExist(req.params.id, res)) return
85 78
@@ -112,8 +105,6 @@ const videoFilesDeleteHLSFileValidator = [
112 .custom(isIdValid), 105 .custom(isIdValid),
113 106
114 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 107 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
115 logger.debug('Checking videoFilesDeleteHLSFile parameters', { parameters: req.params })
116
117 if (areValidationErrors(req, res)) return 108 if (areValidationErrors(req, res)) return
118 if (!await doesVideoExist(req.params.id, res)) return 109 if (!await doesVideoExist(req.params.id, res)) return
119 110