diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-12-11 21:50:51 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-12-19 21:22:28 +0100 |
commit | feb4bdfd9b46e87aadfa7c0d5338cde887d1f58c (patch) | |
tree | 2abc9fbc9569760e218fd52835850b757344b420 /server/helpers/custom-validators | |
parent | 108626609eda75e4ecc0a83a650a4d53c46220e0 (diff) | |
download | PeerTube-feb4bdfd9b46e87aadfa7c0d5338cde887d1f58c.tar.gz PeerTube-feb4bdfd9b46e87aadfa7c0d5338cde887d1f58c.tar.zst PeerTube-feb4bdfd9b46e87aadfa7c0d5338cde887d1f58c.zip |
First version with PostgreSQL
Diffstat (limited to 'server/helpers/custom-validators')
-rw-r--r-- | server/helpers/custom-validators/videos.js | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/server/helpers/custom-validators/videos.js b/server/helpers/custom-validators/videos.js index 1a7753265..be8256a80 100644 --- a/server/helpers/custom-validators/videos.js +++ b/server/helpers/custom-validators/videos.js | |||
@@ -13,7 +13,7 @@ const videosValidators = { | |||
13 | isVideoDateValid, | 13 | isVideoDateValid, |
14 | isVideoDescriptionValid, | 14 | isVideoDescriptionValid, |
15 | isVideoDurationValid, | 15 | isVideoDurationValid, |
16 | isVideoMagnetValid, | 16 | isVideoInfoHashValid, |
17 | isVideoNameValid, | 17 | isVideoNameValid, |
18 | isVideoPodHostValid, | 18 | isVideoPodHostValid, |
19 | isVideoTagsValid, | 19 | isVideoTagsValid, |
@@ -28,14 +28,15 @@ function isEachRemoteVideosValid (requests) { | |||
28 | return ( | 28 | return ( |
29 | isRequestTypeAddValid(request.type) && | 29 | isRequestTypeAddValid(request.type) && |
30 | isVideoAuthorValid(video.author) && | 30 | isVideoAuthorValid(video.author) && |
31 | isVideoDateValid(video.createdDate) && | 31 | isVideoDateValid(video.createdAt) && |
32 | isVideoDescriptionValid(video.description) && | 32 | isVideoDescriptionValid(video.description) && |
33 | isVideoDurationValid(video.duration) && | 33 | isVideoDurationValid(video.duration) && |
34 | isVideoMagnetValid(video.magnet) && | 34 | isVideoInfoHashValid(video.infoHash) && |
35 | isVideoNameValid(video.name) && | 35 | isVideoNameValid(video.name) && |
36 | isVideoTagsValid(video.tags) && | 36 | isVideoTagsValid(video.tags) && |
37 | isVideoThumbnail64Valid(video.thumbnailBase64) && | 37 | isVideoThumbnail64Valid(video.thumbnailBase64) && |
38 | isVideoRemoteIdValid(video.remoteId) | 38 | isVideoRemoteIdValid(video.remoteId) && |
39 | isVideoExtnameValid(video.extname) | ||
39 | ) || | 40 | ) || |
40 | ( | 41 | ( |
41 | isRequestTypeRemoveValid(request.type) && | 42 | isRequestTypeRemoveValid(request.type) && |
@@ -61,8 +62,12 @@ function isVideoDurationValid (value) { | |||
61 | return validator.isInt(value + '', VIDEOS_CONSTRAINTS_FIELDS.DURATION) | 62 | return validator.isInt(value + '', VIDEOS_CONSTRAINTS_FIELDS.DURATION) |
62 | } | 63 | } |
63 | 64 | ||
64 | function isVideoMagnetValid (value) { | 65 | function isVideoExtnameValid (value) { |
65 | return validator.isLength(value.infoHash, VIDEOS_CONSTRAINTS_FIELDS.MAGNET.INFO_HASH) | 66 | return VIDEOS_CONSTRAINTS_FIELDS.EXTNAME.indexOf(value) !== -1 |
67 | } | ||
68 | |||
69 | function isVideoInfoHashValid (value) { | ||
70 | return validator.isLength(value, VIDEOS_CONSTRAINTS_FIELDS.INFO_HASH) | ||
66 | } | 71 | } |
67 | 72 | ||
68 | function isVideoNameValid (value) { | 73 | function isVideoNameValid (value) { |
@@ -93,7 +98,7 @@ function isVideoThumbnail64Valid (value) { | |||
93 | } | 98 | } |
94 | 99 | ||
95 | function isVideoRemoteIdValid (value) { | 100 | function isVideoRemoteIdValid (value) { |
96 | return validator.isMongoId(value) | 101 | return validator.isUUID(value, 4) |
97 | } | 102 | } |
98 | 103 | ||
99 | // --------------------------------------------------------------------------- | 104 | // --------------------------------------------------------------------------- |