X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fmiddlewares%2Fvalidators%2Ffeeds.ts;h=04b4e00c9c6a6b6f7b43346c433d0327a471843a;hb=9452d4fd3321148fb80b64a67bd9983fee6c208e;hp=1a5a8ffa0a71e2b2e5296de25ed004350d70dc76;hpb=c0e8b12e7fd554ba4d2ceb0c4900804c6a4c63ea;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/middlewares/validators/feeds.ts b/server/middlewares/validators/feeds.ts index 1a5a8ffa0..04b4e00c9 100644 --- a/server/middlewares/validators/feeds.ts +++ b/server/middlewares/validators/feeds.ts @@ -1,12 +1,12 @@ -import * as express from 'express' +import express from 'express' import { param, query } from 'express-validator' - import { HttpStatusCode } from '../../../shared/models/http/http-error-codes' import { isValidRSSFeed } from '../../helpers/custom-validators/feeds' import { exists, isIdOrUUIDValid, isIdValid, toCompleteUUID } from '../../helpers/custom-validators/misc' import { logger } from '../../helpers/logger' import { areValidationErrors, + checkCanSeeVideo, doesAccountIdExist, doesAccountNameWithHostExist, doesUserFeedTokenCorrespond, @@ -113,7 +113,10 @@ const videoCommentsFeedsValidator = [ return res.fail({ message: 'videoId cannot be mixed with a channel filter' }) } - if (req.query.videoId && !await doesVideoExist(req.query.videoId, res)) return + if (req.query.videoId) { + if (!await doesVideoExist(req.query.videoId, res)) return + if (!await checkCanSeeVideo({ req, res, paramId: req.query.videoId, video: res.locals.videoAll })) return + } return next() }