]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/middlewares/validators/feeds.ts
Begin live tests
[github/Chocobozzz/PeerTube.git] / server / middlewares / validators / feeds.ts
index 29f6c87bebfaa35890b5d31556ccdae86c739742..c3de0f5fec93fe7fd376e8780a035614ff65c208 100644 (file)
@@ -22,13 +22,13 @@ function setFeedFormatContentType (req: express.Request, res: express.Response,
 
   let acceptableContentTypes: string[]
   if (format === 'atom' || format === 'atom1') {
-    acceptableContentTypes = ['application/atom+xml', 'application/xml', 'text/xml']
+    acceptableContentTypes = [ 'application/atom+xml', 'application/xml', 'text/xml' ]
   } else if (format === 'json' || format === 'json1') {
-    acceptableContentTypes = ['application/json']
+    acceptableContentTypes = [ 'application/json' ]
   } else if (format === 'rss' || format === 'rss2') {
-    acceptableContentTypes = ['application/rss+xml', 'application/xml', 'text/xml']
+    acceptableContentTypes = [ 'application/rss+xml', 'application/xml', 'text/xml' ]
   } else {
-    acceptableContentTypes = ['application/xml', 'text/xml']
+    acceptableContentTypes = [ 'application/xml', 'text/xml' ]
   }
 
   if (req.accepts(acceptableContentTypes)) {
@@ -70,6 +70,12 @@ const videoCommentsFeedsValidator = [
 
     if (areValidationErrors(req, res)) return
 
+    if (req.query.videoId && (req.query.videoChannelId || req.query.videoChannelName)) {
+      return res.status(400).send({
+        message: 'videoId cannot be mixed with a channel filter'
+      }).end()
+    }
+
     if (req.query.videoId && !await doesVideoExist(req.query.videoId, res)) return
 
     return next()