aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/validators
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2023-07-25 15:17:58 +0200
committerChocobozzz <me@florianbigard.com>2023-07-25 15:17:58 +0200
commit9901c8d6908a43ab4594406446eac770ee21176c (patch)
treecc59c2c45d96bd51053e283db1121baa2723b765 /server/middlewares/validators
parent3b46eec8aeb95eb0dce763e3569c0509b1da7607 (diff)
downloadPeerTube-9901c8d6908a43ab4594406446eac770ee21176c.tar.gz
PeerTube-9901c8d6908a43ab4594406446eac770ee21176c.tar.zst
PeerTube-9901c8d6908a43ab4594406446eac770ee21176c.zip
Add video file update hook tests
Diffstat (limited to 'server/middlewares/validators')
-rw-r--r--server/middlewares/validators/videos/shared/video-validators.ts8
1 files changed, 2 insertions, 6 deletions
diff --git a/server/middlewares/validators/videos/shared/video-validators.ts b/server/middlewares/validators/videos/shared/video-validators.ts
index 72536011d..95e4fef11 100644
--- a/server/middlewares/validators/videos/shared/video-validators.ts
+++ b/server/middlewares/validators/videos/shared/video-validators.ts
@@ -45,7 +45,7 @@ export async function isVideoFileAccepted (options: {
45 videoFile: express.VideoUploadFile 45 videoFile: express.VideoUploadFile
46 hook: Extract<ServerFilterHookName, 'filter:api.video.upload.accept.result' | 'filter:api.video.update-file.accept.result'> 46 hook: Extract<ServerFilterHookName, 'filter:api.video.upload.accept.result' | 'filter:api.video.update-file.accept.result'>
47}) { 47}) {
48 const { req, res, videoFile } = options 48 const { req, res, videoFile, hook } = options
49 49
50 // Check we accept this video 50 // Check we accept this video
51 const acceptParameters = { 51 const acceptParameters = {
@@ -53,11 +53,7 @@ export async function isVideoFileAccepted (options: {
53 videoFile, 53 videoFile,
54 user: res.locals.oauth.token.User 54 user: res.locals.oauth.token.User
55 } 55 }
56 const acceptedResult = await Hooks.wrapFun( 56 const acceptedResult = await Hooks.wrapFun(isLocalVideoFileAccepted, acceptParameters, hook)
57 isLocalVideoFileAccepted,
58 acceptParameters,
59 'filter:api.video.upload.accept.result'
60 )
61 57
62 if (!acceptedResult || acceptedResult.accepted !== true) { 58 if (!acceptedResult || acceptedResult.accepted !== true) {
63 logger.info('Refused local video file.', { acceptedResult, acceptParameters }) 59 logger.info('Refused local video file.', { acceptedResult, acceptParameters })