X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fmiddlewares%2Fvalidators%2Fvideos%2Fvideos.ts;h=a027c4840ef3861643b20ae6355170075fc3d197;hb=943e5193905908dd1f2800d8810c635d86e3b28f;hp=11dd02706570421382b27d121aac0cb92a056ada;hpb=7cd1b12c19d0589d1d692ed0571ca0800f028aea;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/middlewares/validators/videos/videos.ts b/server/middlewares/validators/videos/videos.ts index 11dd02706..a027c4840 100644 --- a/server/middlewares/validators/videos/videos.ts +++ b/server/middlewares/validators/videos/videos.ts @@ -147,7 +147,10 @@ async function checkVideoFollowConstraints (req: express.Request, res: express.R }) } -const videosCustomGetValidator = (fetchType: 'all' | 'only-video' | 'only-video-with-rights', authenticateInQuery = false) => { +const videosCustomGetValidator = ( + fetchType: 'all' | 'only-video' | 'only-video-with-rights' | 'only-immutable-attributes', + authenticateInQuery = false +) => { return [ param('id').custom(isIdOrUUIDValid).not().isEmpty().withMessage('Should have a valid id'), @@ -157,6 +160,9 @@ const videosCustomGetValidator = (fetchType: 'all' | 'only-video' | 'only-video- if (areValidationErrors(req, res)) return if (!await doesVideoExist(req.params.id, res, fetchType)) return + // Controllers does not need to check video rights + if (fetchType === 'only-immutable-attributes') return next() + const video = getVideoWithAttributes(res) const videoAll = video as MVideoFullLight