diff options
author | Chocobozzz <me@florianbigard.com> | 2018-04-23 14:39:52 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-04-23 14:39:52 +0200 |
commit | 9d3ef9fe052ed29bd67566754cb28662bd122234 (patch) | |
tree | 7b704dbc0b2c8b4ca18bef2409d640d0019c3d0a /server/helpers/custom-validators/videos.ts | |
parent | 2a2c19dfef7a9aa313c6ca0798f271c9a63449a9 (diff) | |
download | PeerTube-9d3ef9fe052ed29bd67566754cb28662bd122234.tar.gz PeerTube-9d3ef9fe052ed29bd67566754cb28662bd122234.tar.zst PeerTube-9d3ef9fe052ed29bd67566754cb28662bd122234.zip |
Use ISO 639 for languages
Diffstat (limited to 'server/helpers/custom-validators/videos.ts')
-rw-r--r-- | server/helpers/custom-validators/videos.ts | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/server/helpers/custom-validators/videos.ts b/server/helpers/custom-validators/videos.ts index a46d715ba..23d2d8ac6 100644 --- a/server/helpers/custom-validators/videos.ts +++ b/server/helpers/custom-validators/videos.ts | |||
@@ -18,16 +18,17 @@ import { exists, isArray, isFileValid } from './misc' | |||
18 | const VIDEOS_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.VIDEOS | 18 | const VIDEOS_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.VIDEOS |
19 | const VIDEO_ABUSES_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.VIDEO_ABUSES | 19 | const VIDEO_ABUSES_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.VIDEO_ABUSES |
20 | 20 | ||
21 | function isVideoCategoryValid (value: number) { | 21 | function isVideoCategoryValid (value: any) { |
22 | return value === null || VIDEO_CATEGORIES[value] !== undefined | 22 | return value === null || VIDEO_CATEGORIES[value] !== undefined |
23 | } | 23 | } |
24 | 24 | ||
25 | function isVideoLicenceValid (value: number) { | 25 | function isVideoLicenceValid (value: any) { |
26 | return value === null || VIDEO_LICENCES[value] !== undefined | 26 | return value === null || VIDEO_LICENCES[value] !== undefined |
27 | } | 27 | } |
28 | 28 | ||
29 | function isVideoLanguageValid (value: number) { | 29 | function isVideoLanguageValid (value: any) { |
30 | return value === null || VIDEO_LANGUAGES[value] !== undefined | 30 | return value === null || |
31 | (typeof value === 'string' && validator.isLength(value, VIDEOS_CONSTRAINTS_FIELDS.LANGUAGE)) | ||
31 | } | 32 | } |
32 | 33 | ||
33 | function isVideoDurationValid (value: string) { | 34 | function isVideoDurationValid (value: string) { |