From 9d3ef9fe052ed29bd67566754cb28662bd122234 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 23 Apr 2018 14:39:52 +0200 Subject: Use ISO 639 for languages --- server/helpers/custom-validators/videos.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'server/helpers/custom-validators/videos.ts') 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' const VIDEOS_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.VIDEOS const VIDEO_ABUSES_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.VIDEO_ABUSES -function isVideoCategoryValid (value: number) { +function isVideoCategoryValid (value: any) { return value === null || VIDEO_CATEGORIES[value] !== undefined } -function isVideoLicenceValid (value: number) { +function isVideoLicenceValid (value: any) { return value === null || VIDEO_LICENCES[value] !== undefined } -function isVideoLanguageValid (value: number) { - return value === null || VIDEO_LANGUAGES[value] !== undefined +function isVideoLanguageValid (value: any) { + return value === null || + (typeof value === 'string' && validator.isLength(value, VIDEOS_CONSTRAINTS_FIELDS.LANGUAGE)) } function isVideoDurationValid (value: string) { -- cgit v1.2.3