diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-12-11 11:06:32 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-12-11 11:06:32 +0100 |
commit | fada8d75550dc7365f7e18ee1569b9406251d660 (patch) | |
tree | db9dc01c18693824f83fce5020f4c1f3ae7c0865 /server/helpers/custom-validators/videos.ts | |
parent | 492fd28167f770d79a430fc57451b5a9e075d8e7 (diff) | |
parent | c2830fa8f84f61462098bf36add824f89436dfa9 (diff) | |
download | PeerTube-fada8d75550dc7365f7e18ee1569b9406251d660.tar.gz PeerTube-fada8d75550dc7365f7e18ee1569b9406251d660.tar.zst PeerTube-fada8d75550dc7365f7e18ee1569b9406251d660.zip |
Merge branch 'feature/design' into develop
Diffstat (limited to 'server/helpers/custom-validators/videos.ts')
-rw-r--r-- | server/helpers/custom-validators/videos.ts | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/server/helpers/custom-validators/videos.ts b/server/helpers/custom-validators/videos.ts index f13178c54..37fa8b08a 100644 --- a/server/helpers/custom-validators/videos.ts +++ b/server/helpers/custom-validators/videos.ts | |||
@@ -14,11 +14,11 @@ const VIDEOS_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.VIDEOS | |||
14 | const VIDEO_ABUSES_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.VIDEO_ABUSES | 14 | const VIDEO_ABUSES_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.VIDEO_ABUSES |
15 | 15 | ||
16 | function isVideoCategoryValid (value: number) { | 16 | function isVideoCategoryValid (value: number) { |
17 | return VIDEO_CATEGORIES[value] !== undefined | 17 | return value === null || VIDEO_CATEGORIES[value] !== undefined |
18 | } | 18 | } |
19 | 19 | ||
20 | function isVideoLicenceValid (value: number) { | 20 | function isVideoLicenceValid (value: number) { |
21 | return VIDEO_LICENCES[value] !== undefined | 21 | return value === null || VIDEO_LICENCES[value] !== undefined |
22 | } | 22 | } |
23 | 23 | ||
24 | function isVideoLanguageValid (value: number) { | 24 | function isVideoLanguageValid (value: number) { |
@@ -38,7 +38,7 @@ function isVideoTruncatedDescriptionValid (value: string) { | |||
38 | } | 38 | } |
39 | 39 | ||
40 | function isVideoDescriptionValid (value: string) { | 40 | function isVideoDescriptionValid (value: string) { |
41 | return exists(value) && validator.isLength(value, VIDEOS_CONSTRAINTS_FIELDS.DESCRIPTION) | 41 | return value === null || (exists(value) && validator.isLength(value, VIDEOS_CONSTRAINTS_FIELDS.DESCRIPTION)) |
42 | } | 42 | } |
43 | 43 | ||
44 | function isVideoNameValid (value: string) { | 44 | function isVideoNameValid (value: string) { |
@@ -84,7 +84,7 @@ function isVideoFile (files: { [ fieldname: string ]: Express.Multer.File[] } | | |||
84 | } | 84 | } |
85 | 85 | ||
86 | function isVideoPrivacyValid (value: string) { | 86 | function isVideoPrivacyValid (value: string) { |
87 | return VIDEO_PRIVACIES[value] !== undefined | 87 | return validator.isInt(value + '') && VIDEO_PRIVACIES[value] !== undefined |
88 | } | 88 | } |
89 | 89 | ||
90 | function isVideoFileInfoHashValid (value: string) { | 90 | function isVideoFileInfoHashValid (value: string) { |