]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/middlewares/validators/videos/video-shares.ts
Allow users/visitors to search through an account's videos (#3589)
[github/Chocobozzz/PeerTube.git] / server / middlewares / validators / videos / video-shares.ts
index ace62be5cade3a1171e6043cd8cad653c356bd05..f0d8e0c360529712ffb6ae8daf868e0a544938d0 100644 (file)
@@ -5,6 +5,7 @@ import { logger } from '../../../helpers/logger'
 import { VideoShareModel } from '../../../models/video/video-share'
 import { areValidationErrors } from '../utils'
 import { doesVideoExist } from '../../../helpers/middlewares'
+import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
 
 const videosShareValidator = [
   param('id').custom(isIdOrUUIDValid).not().isEmpty().withMessage('Should have a valid id'),
@@ -16,11 +17,11 @@ const videosShareValidator = [
     if (areValidationErrors(req, res)) return
     if (!await doesVideoExist(req.params.id, res)) return
 
-    const video = res.locals.video
+    const video = res.locals.videoAll
 
     const share = await VideoShareModel.load(req.params.actorId, video.id)
     if (!share) {
-      return res.status(404)
+      return res.status(HttpStatusCode.NOT_FOUND_404)
                 .end()
     }