aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/validators
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-06-02 18:15:41 +0200
committerChocobozzz <me@florianbigard.com>2021-06-02 18:15:41 +0200
commite030bfb59dd5ee65f20a64686ec9b22ca39f70ae (patch)
treec9a439159ef540291e3c030bcaf958b953442147 /server/middlewares/validators
parent463206948d6a9d46e7e68d55c7b763e601ecc870 (diff)
downloadPeerTube-e030bfb59dd5ee65f20a64686ec9b22ca39f70ae.tar.gz
PeerTube-e030bfb59dd5ee65f20a64686ec9b22ca39f70ae.tar.zst
PeerTube-e030bfb59dd5ee65f20a64686ec9b22ca39f70ae.zip
Refactor server errors handler
Diffstat (limited to 'server/middlewares/validators')
-rw-r--r--server/middlewares/validators/videos/videos.ts6
1 files changed, 0 insertions, 6 deletions
diff --git a/server/middlewares/validators/videos/videos.ts b/server/middlewares/validators/videos/videos.ts
index 64e09234e..b7a9bcbe3 100644
--- a/server/middlewares/validators/videos/videos.ts
+++ b/server/middlewares/validators/videos/videos.ts
@@ -73,7 +73,6 @@ const videosAddLegacyValidator = getCommonVideoEditAttributes().concat([
73 .custom(isIdValid).withMessage('Should have correct video channel id'), 73 .custom(isIdValid).withMessage('Should have correct video channel id'),
74 74
75 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 75 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
76 res.docs = "https://docs.joinpeertube.org/api-rest-reference.html#operation/uploadLegacy"
77 logger.debug('Checking videosAdd parameters', { parameters: req.body, files: req.files }) 76 logger.debug('Checking videosAdd parameters', { parameters: req.body, files: req.files })
78 77
79 if (areValidationErrors(req, res)) return cleanUpReqFiles(req) 78 if (areValidationErrors(req, res)) return cleanUpReqFiles(req)
@@ -108,7 +107,6 @@ const videosAddLegacyValidator = getCommonVideoEditAttributes().concat([
108 */ 107 */
109const videosAddResumableValidator = [ 108const videosAddResumableValidator = [
110 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 109 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
111 res.docs = "https://docs.joinpeertube.org/api-rest-reference.html#operation/uploadResumable"
112 const user = res.locals.oauth.token.User 110 const user = res.locals.oauth.token.User
113 111
114 const body: express.CustomUploadXFile<express.UploadXFileMetadata> = req.body 112 const body: express.CustomUploadXFile<express.UploadXFileMetadata> = req.body
@@ -170,7 +168,6 @@ const videosAddResumableInitValidator = getCommonVideoEditAttributes().concat([
170 .withMessage('Should specify the file mimetype'), 168 .withMessage('Should specify the file mimetype'),
171 169
172 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 170 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
173 res.docs = "https://docs.joinpeertube.org/api-rest-reference.html#operation/uploadResumableInit"
174 const videoFileMetadata = { 171 const videoFileMetadata = {
175 mimetype: req.headers['x-upload-content-type'] as string, 172 mimetype: req.headers['x-upload-content-type'] as string,
176 size: +req.headers['x-upload-content-length'], 173 size: +req.headers['x-upload-content-length'],
@@ -214,7 +211,6 @@ const videosUpdateValidator = getCommonVideoEditAttributes().concat([
214 .custom(isIdValid).withMessage('Should have correct video channel id'), 211 .custom(isIdValid).withMessage('Should have correct video channel id'),
215 212
216 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 213 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
217 res.docs = 'https://docs.joinpeertube.org/api-rest-reference.html#operation/putVideo'
218 logger.debug('Checking videosUpdate parameters', { parameters: req.body }) 214 logger.debug('Checking videosUpdate parameters', { parameters: req.body })
219 215
220 if (areValidationErrors(req, res)) return cleanUpReqFiles(req) 216 if (areValidationErrors(req, res)) return cleanUpReqFiles(req)
@@ -268,7 +264,6 @@ const videosCustomGetValidator = (
268 param('id').custom(isIdOrUUIDValid).not().isEmpty().withMessage('Should have a valid id'), 264 param('id').custom(isIdOrUUIDValid).not().isEmpty().withMessage('Should have a valid id'),
269 265
270 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 266 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
271 res.docs = 'https://docs.joinpeertube.org/api-rest-reference.html#operation/getVideo'
272 logger.debug('Checking videosGet parameters', { parameters: req.params }) 267 logger.debug('Checking videosGet parameters', { parameters: req.params })
273 268
274 if (areValidationErrors(req, res)) return 269 if (areValidationErrors(req, res)) return
@@ -334,7 +329,6 @@ const videosRemoveValidator = [
334 param('id').custom(isIdOrUUIDValid).not().isEmpty().withMessage('Should have a valid id'), 329 param('id').custom(isIdOrUUIDValid).not().isEmpty().withMessage('Should have a valid id'),
335 330
336 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 331 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
337 res.docs = "https://docs.joinpeertube.org/api-rest-reference.html#operation/delVideo"
338 logger.debug('Checking videosRemove parameters', { parameters: req.params }) 332 logger.debug('Checking videosRemove parameters', { parameters: req.params })
339 333
340 if (areValidationErrors(req, res)) return 334 if (areValidationErrors(req, res)) return