diff options
Diffstat (limited to 'server/helpers/custom-validators/videos.ts')
-rw-r--r-- | server/helpers/custom-validators/videos.ts | 36 |
1 files changed, 3 insertions, 33 deletions
diff --git a/server/helpers/custom-validators/videos.ts b/server/helpers/custom-validators/videos.ts index 1d27e47fc..2eb021ae7 100644 --- a/server/helpers/custom-validators/videos.ts +++ b/server/helpers/custom-validators/videos.ts | |||
@@ -107,12 +107,13 @@ function isVideoRatingTypeValid (value: string) { | |||
107 | return values(VIDEO_RATE_TYPES).indexOf(value as VideoRateType) !== -1 | 107 | return values(VIDEO_RATE_TYPES).indexOf(value as VideoRateType) !== -1 |
108 | } | 108 | } |
109 | 109 | ||
110 | function isVideoFile (value: string, files: { [ fieldname: string ]: Express.Multer.File[] }) { | 110 | function isVideoFile (files: { [ fieldname: string ]: Express.Multer.File[] } | Express.Multer.File[]) { |
111 | // Should have files | 111 | // Should have files |
112 | if (!files) return false | 112 | if (!files) return false |
113 | if (isArray(files)) return false | ||
113 | 114 | ||
114 | // Should have videofile file | 115 | // Should have videofile file |
115 | const videofile = files.videofile | 116 | const videofile = files['videofile'] |
116 | if (!videofile || videofile.length === 0) return false | 117 | if (!videofile || videofile.length === 0) return false |
117 | 118 | ||
118 | // The file should exist | 119 | // The file should exist |
@@ -168,34 +169,3 @@ export { | |||
168 | isVideoFileSizeValid, | 169 | isVideoFileSizeValid, |
169 | isVideoFileResolutionValid | 170 | isVideoFileResolutionValid |
170 | } | 171 | } |
171 | |||
172 | declare module 'express-validator' { | ||
173 | export interface Validator { | ||
174 | isVideoIdOrUUIDValid, | ||
175 | isVideoAuthorValid, | ||
176 | isVideoDateValid, | ||
177 | isVideoCategoryValid, | ||
178 | isVideoLicenceValid, | ||
179 | isVideoLanguageValid, | ||
180 | isVideoNSFWValid, | ||
181 | isVideoDescriptionValid, | ||
182 | isVideoDurationValid, | ||
183 | isVideoInfoHashValid, | ||
184 | isVideoNameValid, | ||
185 | isVideoTagsValid, | ||
186 | isVideoThumbnailValid, | ||
187 | isVideoThumbnailDataValid, | ||
188 | isVideoExtnameValid, | ||
189 | isVideoUUIDValid, | ||
190 | isVideoAbuseReasonValid, | ||
191 | isVideoAbuseReporterUsernameValid, | ||
192 | isVideoFile, | ||
193 | isVideoViewsValid, | ||
194 | isVideoLikesValid, | ||
195 | isVideoRatingTypeValid, | ||
196 | isVideoDislikesValid, | ||
197 | isVideoEventCountValid, | ||
198 | isVideoFileSizeValid, | ||
199 | isVideoFileResolutionValid | ||
200 | } | ||
201 | } | ||