diff options
Diffstat (limited to 'server/helpers/custom-validators')
-rw-r--r-- | server/helpers/custom-validators/pods.js | 12 | ||||
-rw-r--r-- | server/helpers/custom-validators/videos.js | 6 |
2 files changed, 9 insertions, 9 deletions
diff --git a/server/helpers/custom-validators/pods.js b/server/helpers/custom-validators/pods.js index 40f8b5d0b..0154a2424 100644 --- a/server/helpers/custom-validators/pods.js +++ b/server/helpers/custom-validators/pods.js | |||
@@ -5,14 +5,14 @@ const validator = require('express-validator').validator | |||
5 | const miscValidators = require('./misc') | 5 | const miscValidators = require('./misc') |
6 | 6 | ||
7 | const podsValidators = { | 7 | const podsValidators = { |
8 | isEachUniqueUrlValid | 8 | isEachUniqueHostValid |
9 | } | 9 | } |
10 | 10 | ||
11 | function isEachUniqueUrlValid (urls) { | 11 | function isEachUniqueHostValid (hosts) { |
12 | return miscValidators.isArray(urls) && | 12 | return miscValidators.isArray(hosts) && |
13 | urls.length !== 0 && | 13 | hosts.length !== 0 && |
14 | urls.every(function (url) { | 14 | hosts.every(function (host) { |
15 | return validator.isURL(url) && urls.indexOf(url) === urls.lastIndexOf(url) | 15 | return validator.isURL(host) && host.split('://').length === 1 && hosts.indexOf(host) === hosts.lastIndexOf(host) |
16 | }) | 16 | }) |
17 | } | 17 | } |
18 | 18 | ||
diff --git a/server/helpers/custom-validators/videos.js b/server/helpers/custom-validators/videos.js index 45acb7686..4a6a62326 100644 --- a/server/helpers/custom-validators/videos.js +++ b/server/helpers/custom-validators/videos.js | |||
@@ -15,7 +15,7 @@ const videosValidators = { | |||
15 | isVideoDurationValid, | 15 | isVideoDurationValid, |
16 | isVideoMagnetValid, | 16 | isVideoMagnetValid, |
17 | isVideoNameValid, | 17 | isVideoNameValid, |
18 | isVideoPodUrlValid, | 18 | isVideoPodHostValid, |
19 | isVideoTagsValid, | 19 | isVideoTagsValid, |
20 | isVideoThumbnailValid, | 20 | isVideoThumbnailValid, |
21 | isVideoThumbnail64Valid | 21 | isVideoThumbnail64Valid |
@@ -33,7 +33,7 @@ function isEachRemoteVideosValid (requests) { | |||
33 | isVideoDurationValid(video.duration) && | 33 | isVideoDurationValid(video.duration) && |
34 | isVideoMagnetValid(video.magnet) && | 34 | isVideoMagnetValid(video.magnet) && |
35 | isVideoNameValid(video.name) && | 35 | isVideoNameValid(video.name) && |
36 | isVideoPodUrlValid(video.podUrl) && | 36 | isVideoPodHostValid(video.podHost) && |
37 | isVideoTagsValid(video.tags) && | 37 | isVideoTagsValid(video.tags) && |
38 | isVideoThumbnail64Valid(video.thumbnailBase64) && | 38 | isVideoThumbnail64Valid(video.thumbnailBase64) && |
39 | isVideoRemoteIdValid(video.remoteId) | 39 | isVideoRemoteIdValid(video.remoteId) |
@@ -70,7 +70,7 @@ function isVideoNameValid (value) { | |||
70 | return validator.isLength(value, VIDEOS_CONSTRAINTS_FIELDS.NAME) | 70 | return validator.isLength(value, VIDEOS_CONSTRAINTS_FIELDS.NAME) |
71 | } | 71 | } |
72 | 72 | ||
73 | function isVideoPodUrlValid (value) { | 73 | function isVideoPodHostValid (value) { |
74 | // TODO: set options (TLD...) | 74 | // TODO: set options (TLD...) |
75 | return validator.isURL(value) | 75 | return validator.isURL(value) |
76 | } | 76 | } |