aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/validators/videos/videos.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/middlewares/validators/videos/videos.ts')
-rw-r--r--server/middlewares/validators/videos/videos.ts5
1 files changed, 3 insertions, 2 deletions
diff --git a/server/middlewares/validators/videos/videos.ts b/server/middlewares/validators/videos/videos.ts
index b022b2c23..ff90e347a 100644
--- a/server/middlewares/validators/videos/videos.ts
+++ b/server/middlewares/validators/videos/videos.ts
@@ -1,5 +1,6 @@
1import * as express from 'express' 1import * as express from 'express'
2import { body, param, query, ValidationChain } from 'express-validator' 2import { body, param, query, ValidationChain } from 'express-validator'
3import { isAbleToUploadVideo } from '@server/lib/user'
3import { getServerActor } from '@server/models/application/application' 4import { getServerActor } from '@server/models/application/application'
4import { MVideoFullLight } from '@server/types/models' 5import { MVideoFullLight } from '@server/types/models'
5import { ServerErrorCode, UserRight, VideoChangeOwnershipStatus, VideoPrivacy } from '../../../../shared' 6import { ServerErrorCode, UserRight, VideoChangeOwnershipStatus, VideoPrivacy } from '../../../../shared'
@@ -73,7 +74,7 @@ const videosAddValidator = getCommonVideoEditAttributes().concat([
73 74
74 if (!await doesVideoChannelOfAccountExist(req.body.channelId, user, res)) return cleanUpReqFiles(req) 75 if (!await doesVideoChannelOfAccountExist(req.body.channelId, user, res)) return cleanUpReqFiles(req)
75 76
76 if (await user.isAbleToUploadVideo(videoFile) === false) { 77 if (await isAbleToUploadVideo(user.id, videoFile.size) === false) {
77 res.status(403) 78 res.status(403)
78 .json({ error: 'The user video quota is exceeded with this video.' }) 79 .json({ error: 'The user video quota is exceeded with this video.' })
79 80
@@ -291,7 +292,7 @@ const videosAcceptChangeOwnershipValidator = [
291 292
292 const user = res.locals.oauth.token.User 293 const user = res.locals.oauth.token.User
293 const videoChangeOwnership = res.locals.videoChangeOwnership 294 const videoChangeOwnership = res.locals.videoChangeOwnership
294 const isAble = await user.isAbleToUploadVideo(videoChangeOwnership.Video.getMaxQualityFile()) 295 const isAble = await isAbleToUploadVideo(user.id, videoChangeOwnership.Video.getMaxQualityFile().size)
295 if (isAble === false) { 296 if (isAble === false) {
296 res.status(403) 297 res.status(403)
297 .json({ error: 'The user video quota is exceeded with this video.' }) 298 .json({ error: 'The user video quota is exceeded with this video.' })