]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/middlewares/validators/feeds.ts
Correctly close RTMPS server too
[github/Chocobozzz/PeerTube.git] / server / middlewares / validators / feeds.ts
index aa16cc99378b2148eeaf4846f9d62e1c3d6df172..f8ebaf6ed87d65cb360fe6465c56b625d3acd0ca 100644 (file)
@@ -1,18 +1,18 @@
-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 } from '../../helpers/custom-validators/misc'
+import { exists, isIdOrUUIDValid, isIdValid, toCompleteUUID } from '../../helpers/custom-validators/misc'
 import { logger } from '../../helpers/logger'
 import {
+  areValidationErrors,
   doesAccountIdExist,
   doesAccountNameWithHostExist,
   doesUserFeedTokenCorrespond,
   doesVideoChannelIdExist,
-  doesVideoChannelNameWithHostExist
-} from '../../helpers/middlewares'
-import { doesVideoExist } from '../../helpers/middlewares/videos'
-import { areValidationErrors } from './utils'
-import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes'
+  doesVideoChannelNameWithHostExist,
+  doesVideoExist
+} from './shared'
 
 const feedsFormatValidator = [
   param('format').optional().custom(isValidRSSFeed).withMessage('Should have a valid format (rss, atom, json)'),
@@ -98,7 +98,10 @@ const videoSubscriptionFeedsValidator = [
 ]
 
 const videoCommentsFeedsValidator = [
-  query('videoId').optional().custom(isIdOrUUIDValid),
+  query('videoId')
+    .customSanitizer(toCompleteUUID)
+    .optional()
+    .custom(isIdOrUUIDValid),
 
   async (req: express.Request, res: express.Response, next: express.NextFunction) => {
     logger.debug('Checking feeds parameters', { parameters: req.query })