aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/custom-validators/videos.ts
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-09-15 12:17:08 +0200
committerChocobozzz <florian.bigard@gmail.com>2017-09-15 12:17:08 +0200
commitb60e5f38daf77e720a27aa86d3b482c58906a03a (patch)
treea70909860ab9705d348b3c082f8af440e0a5e4d2 /server/helpers/custom-validators/videos.ts
parent315cc0cc1871ab2a6d6c1bb61cf7b9f10511c3a9 (diff)
downloadPeerTube-b60e5f38daf77e720a27aa86d3b482c58906a03a.tar.gz
PeerTube-b60e5f38daf77e720a27aa86d3b482c58906a03a.tar.zst
PeerTube-b60e5f38daf77e720a27aa86d3b482c58906a03a.zip
Upgrade express validator to v4
Diffstat (limited to 'server/helpers/custom-validators/videos.ts')
-rw-r--r--server/helpers/custom-validators/videos.ts36
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
110function isVideoFile (value: string, files: { [ fieldname: string ]: Express.Multer.File[] }) { 110function 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
172declare 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}