aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/validators/videos/video-studio.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/middlewares/validators/videos/video-studio.ts')
-rw-r--r--server/middlewares/validators/videos/video-studio.ts12
1 files changed, 3 insertions, 9 deletions
diff --git a/server/middlewares/validators/videos/video-studio.ts b/server/middlewares/validators/videos/video-studio.ts
index 7a68f88e5..a375af60a 100644
--- a/server/middlewares/validators/videos/video-studio.ts
+++ b/server/middlewares/validators/videos/video-studio.ts
@@ -11,8 +11,9 @@ import { cleanUpReqFiles } from '@server/helpers/express-utils'
11import { CONFIG } from '@server/initializers/config' 11import { CONFIG } from '@server/initializers/config'
12import { approximateIntroOutroAdditionalSize, getTaskFileFromReq } from '@server/lib/video-studio' 12import { approximateIntroOutroAdditionalSize, getTaskFileFromReq } from '@server/lib/video-studio'
13import { isAudioFile } from '@shared/ffmpeg' 13import { isAudioFile } from '@shared/ffmpeg'
14import { HttpStatusCode, UserRight, VideoState, VideoStudioCreateEdition, VideoStudioTask } from '@shared/models' 14import { HttpStatusCode, UserRight, VideoStudioCreateEdition, VideoStudioTask } from '@shared/models'
15import { areValidationErrors, checkUserCanManageVideo, checkUserQuota, doesVideoExist } from '../shared' 15import { areValidationErrors, checkUserCanManageVideo, checkUserQuota, doesVideoExist } from '../shared'
16import { checkVideoFileCanBeEdited } from './shared'
16 17
17const videoStudioAddEditionValidator = [ 18const videoStudioAddEditionValidator = [
18 param('videoId') 19 param('videoId')
@@ -66,14 +67,7 @@ const videoStudioAddEditionValidator = [
66 if (!await doesVideoExist(req.params.videoId, res)) return cleanUpReqFiles(req) 67 if (!await doesVideoExist(req.params.videoId, res)) return cleanUpReqFiles(req)
67 68
68 const video = res.locals.videoAll 69 const video = res.locals.videoAll
69 if (video.state === VideoState.TO_TRANSCODE || video.state === VideoState.TO_EDIT) { 70 if (!checkVideoFileCanBeEdited(video, res)) return cleanUpReqFiles(req)
70 res.fail({
71 status: HttpStatusCode.CONFLICT_409,
72 message: 'Cannot edit video that is already waiting for transcoding/edition'
73 })
74
75 return cleanUpReqFiles(req)
76 }
77 71
78 const user = res.locals.oauth.token.User 72 const user = res.locals.oauth.token.User
79 if (!checkUserCanManageVideo(user, video, UserRight.UPDATE_ANY_VIDEO, res)) return cleanUpReqFiles(req) 73 if (!checkUserCanManageVideo(user, video, UserRight.UPDATE_ANY_VIDEO, res)) return cleanUpReqFiles(req)